0 votes
1 view
in BI by (17.6k points)

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 in 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

enter image description here

The result of CPC is not correct in Tableau.

1 Answer

0 votes
by (47.2k points)
selected by
Best answer
  • The problem seems to be 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.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !