Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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 first line, when it should be: 0.58%
And it return 0,80 for the second, when it should be 0,83.
My Column CTR is :
Solved! Go to Solution.
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 ,
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 ,
What does your Start Date look like? What is the relationship between the date and the value?
Sorry for that the information you have provided is not making the problem clear to me. Can you please share more details to help us clarify your scenario?
Please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.
Refer to:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
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,
This is the format.
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.
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 :).
@jhlatinia Are Impressions and Clicks measures? If so, what are the formulas?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 43 | |
| 39 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 68 | |
| 63 | |
| 31 | |
| 30 | |
| 23 |