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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculate summary with average inside

Hello world, 
new to DAX and PBI and full of questions.!
I have this 

Amount Converted= 
[Amount] * AVERAGE('Rates'[USD Conversion Rate])

that works fine with each of the lines , but for aggregated data/summary is wrong (e.g excel summary of the numbers shows 900 usd which is correct, but pbi shows 400usd). I feel there's something wrong with the summarization of the average but do not know exactly what happens. Anyone faced this issue?Any suggestions?
Thank!
 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I think this one works @amitchandak 

 

AP Invoice Corporate Amount = 
sumx('Invoice',[Amount] * RELATED('Rates'[USD Conversion Rate]))

 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous 

You have force a row context, else it will again calculate total


Amount Converted=
sumx(summarize(table,table[Level],"_1",[Amount] * AVERAGE('Rates'[USD Conversion Rate])),[_1])

 

Table[Level] is the column or set columns that you can use to get correct row level

Anonymous
Not applicable

Hi @amitchandak , great insight on this type of calcs, didn't know that I could do something like this.
I get what you do but unfortunately it gives me the exact same number with the previous calculation, although I have used a unique ID as level, so the row level seems ok. I have a suspicion that the average is being calculated for the whole column, despite filters applied to it (it is part of a drillthrough report)

Anonymous
Not applicable

I think this one works @amitchandak 

 

AP Invoice Corporate Amount = 
sumx('Invoice',[Amount] * RELATED('Rates'[USD Conversion Rate]))

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.