QBoard » Advanced Visualizations » Viz - Tableau » Tableau CPC calculation

Tableau CPC calculation

  • I have a problem with calculating CPC in Tableau. I have the cost and the number of the click but Tableau is not calculating the right CPC. the formula I used : [Cost]/[Click] I attached two tables in this request. first shows the table which I calculated all KPIs in Zeppelin. the second the calculation in Tableau.

    The whole data set has many null and 0 values, but it is the same data set used in zeppelin.

    May I ask for help,how to solve this issue?
    enter image description here
    The result of CPC is not correct in Tableau.

      December 1, 2021 3:13 PM IST
    0
  • SUM([cost]) / SUM([clicks]) will resolve the issue

     
      December 2, 2021 2:46 PM IST
    0
  • the issue is that Tableau is using aggregate functions when you add measures, and in this case of CPC calculation, it's not correct.

    Tableau is doing [cost]/[click] division (on row-level) and then simply averages all those numbers (you are basically calculating an average of an already average number).

    What you are after is a bit different and you have to fix the math to make sure all costs are aggregated first and then divided by sum of all clicks, so:

    SUM([cost]) / SUM([clicks])
    

    This will give you the correct and mathematically sound numbers.

    Hope this helps.

      January 1, 2022 1:58 PM IST
    0