Forum Discussion
Average between two columns not correct
- 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.
Hi jhlatinia ,
Are you trying to calculate the average of the CTR?
Here is my sample:
Please try:
Measure =
VAR _a =
SUMMARIZE (
'LinkedInAds',
LinkedInAds[Group Name],
"CTR",
DIVIDE (
CALCULATE (
SUM ( LinkedInAds[Clicks] ),
FILTER ( 'LinkedInAds', [Group Name] = EARLIER ( LinkedInAds[Group Name] ) )
),
CALCULATE (
SUM ( LinkedInAds[Impressions] ),
FILTER ( 'LinkedInAds', [Group Name] = EARLIER ( LinkedInAds[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.
- jhlatinia3 years agoNew Member
The measure look right, may I had, that Impressions or clicks are the sum of each lines of the last 7 days.
Meaning, I filtered by Start Date which doesn't show in the image, does it change the measure?
Sorry I'm quite new to all of this! And thank you for your help, really appriciated :).