Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Help with Average in Totals row when using multiple measures across 3 tables

I'm really hoping someone can help. 

 

In my report I have to keep various tables in in their non aggregated format so that we can use filters on the criteria.  But I also need to serve a visual with aggregated calculations. This ordinarily wouldn't be a problem but one of my measures is a calculation based on two other measures  - each on a different table. 

 

You can see in my visual below that i have Gross Opens sum and Gross Clicks sum by EmailID. I also have a third column which is a rate based on Clicks / Opens. 

 

In the total row, I need to show the AVERAGE CTR.  You can see ini the example calculation in Excel vis the example from PBI the different results for the total Average for the CTR column

 

Example Calculation in Excel (CORRECT):

pbi_visual.png

 

How PowerBI calculates (INCORRECT RATE_Gross CTR on Total row - should be AVG by aggregate emailID:

pbi_report.png

I hope this makes sense how I explained. 

I do have a simple PBI report I can share but i don't see a link to attach a file. 

2 ACCEPTED SOLUTIONS
jdbuchanan71
Super User
Super User

Hello @Anonymous 

 

I was able to get it to work by changing the summing mesaures to return 0 for blanks and using AVERAGEX:

Gross Opens = 
VAR 
    Opens = SUM (opens_table[open_count])
RETURN
    IF ( ISBLANK ( Opens ), 0 , Opens )

Gross Clicks = 
VAR 
    clicks = SUM ( clicks_table[click_count] )
RETURN
    IF ( ISBLANK ( clicks ) , 0 , clicks )

CTR = 
    AVERAGEX( emails , DIVIDE ( [Gross Clicks], [Gross Opens] ) )

avg_ctr.png

 

View solution in original post

Anonymous
Not applicable

Oh my god. I can't believe you figured that out. It worked perfectly. I was going down the entirely wrong path with this one. 

 

Thank you so much for the help! I can't tell you how much I appreciate it! 

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

Hello @Anonymous 

 

I was able to get it to work by changing the summing mesaures to return 0 for blanks and using AVERAGEX:

Gross Opens = 
VAR 
    Opens = SUM (opens_table[open_count])
RETURN
    IF ( ISBLANK ( Opens ), 0 , Opens )

Gross Clicks = 
VAR 
    clicks = SUM ( clicks_table[click_count] )
RETURN
    IF ( ISBLANK ( clicks ) , 0 , clicks )

CTR = 
    AVERAGEX( emails , DIVIDE ( [Gross Clicks], [Gross Opens] ) )

avg_ctr.png

 

Anonymous
Not applicable

Oh my god. I can't believe you figured that out. It worked perfectly. I was going down the entirely wrong path with this one. 

 

Thank you so much for the help! I can't tell you how much I appreciate it! 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.