Forum Discussion
jhlatinia
3 years agoNew Member
Average between two columns not correct
Hello, I've been trying to calculate the average of the division of 2 columns in PowerBi Desktop and not receive the right results. As you can see the column CTR is returning 0,66% for the fi...
- 3 years ago
Hi jhlatinia ,
The result you get is incorrect is because it is the sum of all rows. In other words, they calculate the percentage of each row first and then sum it, which gives a different result than summing and then calculating the percentage.
Please try:
CTR = VAR _a = SUMMARIZE ( 'Table', 'Table'[Campaign Group Name], "CTR", DIVIDE ( CALCULATE ( SUM ( 'Table'[Clicks] ), FILTER ( 'Table', [Campaign Group Name] = EARLIER ( 'Table'[Campaign Group Name] ) ) ), CALCULATE ( SUM ( 'Table'[Impressions] ), FILTER ( 'Table', [Campaign Group Name] = EARLIER ( 'Table'[Campaign Group Name] ) ) ) ) ) RETURN AVERAGEX ( _a, [CTR] )Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
3 years agoCommunity Champion
jhlatinia Are Impressions and Clicks measures? If so, what are the formulas?
jhlatinia
3 years agoNew Member
Greg_Deckler, no they are normal number column data.