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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
AR_Coordo
Frequent Visitor

Aggregation not working with dim table

Hi all,

I am struggling to calculate an aggregated KPI displayed in a matrix.

Let's say I have a dim country table related to a fact sales table :

AR_Coordo_0-1708034761741.png

Country table:

AR_Coordo_3-1708035053142.png

Sales table :

AR_Coordo_4-1708035070460.png

 


My sales are calculated by month and country/city.
I want to display on a matrix the sales total  regardless of the month by country/city and month.

I used this measure :

Total_Sales_Per_Country = calculate(sum('Sales'[Sales]), ALLEXCEPT(Sales, Sales[FK]))

 

However, the result is :

AR_Coordo_1-1708034971254.png


But I want to obtain this :

AR_Coordo_2-1708034997615.png

 

Any idea why it is not working ?

 

Thank you in advance for your help !

 

Regards,

 

Alice

1 ACCEPTED SOLUTION
Daniel29195
Super User
Super User

@AR_Coordo 

 

use this modified version of the code : 

Total_Sales_Per_Country = calculate(sum('Sales'[Sales]), removefilters(sales[Month]) )

or

Total_Sales_Per_Country = calculate(sum('Sales'[Sales]), all(Sales) , values(sales[FK]))


 

 

let me know if this helps .

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

View solution in original post

2 REPLIES 2
Daniel29195
Super User
Super User

@AR_Coordo 

 

use this modified version of the code : 

Total_Sales_Per_Country = calculate(sum('Sales'[Sales]), removefilters(sales[Month]) )

or

Total_Sales_Per_Country = calculate(sum('Sales'[Sales]), all(Sales) , values(sales[FK]))


 

 

let me know if this helps .

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

Thank you for your answer, it worked !

Any idea why it doesn't work if I filter my sales by antoher column from the same table, like 

Total_Sales_Per_Country = calculate(sum('Sales'[Sales]),'Sales'[Category]="XXX", removefilters(sales[Month]) )

?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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