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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
AnthonyJoseph
Resolver III
Resolver III

Measure to return the total value of the group (country and year)

Hello experts,

 

I have a table visual (my input data table as in screenshot below), which has details per country/year/entity. The request is to create a measure that can sum the difference based on the combination of country and year only (ignoring the entity) and to have that as a column in table visual. 

For example: For client A, Country "United States" has records for three entities for year 2022 so the output measure should be 521+100+216 = 837.
Similarly, For client B, Country "Australia" has records for two entities for year 2021 so the output measure should be 228+500 = 728.
Please can some one provide some guidance. Below are the Input and expected output in screenshot.

AnthonyJoseph_1-1711475976709.png

 

Any help is highly appreciated!




6 REPLIES 6
JamesFR06
Resolver IV
Resolver IV

Hi

 

Please try this code : 

Mesure01 = calculate(sum(TableTotal[Amount]),ALLEXCEPT(TableTotal,TableTotal[Client],TableTotal[Country],TableTotal[Year]))
JamesFR06_0-1711477014737.png

 

Hi @JamesFR06  I m getting a different answer, please can you help me. I m getting the same value for all countries and years, please see screenshot below. 

AnthonyJoseph_0-1711526218463.png

 

Hi @AnthonyJoseph 

 

There some relation layong in your model.

With this code it will be ok

calculate(sum(TableTotal[Amount]),TableTotal[Client]=Clt&&TableTotal[Country]=Ctry&&TableTotal[Year]=Annee,all(TableTotal))

@JamesFR06  Looks like the measure is incomplete (TableTotal[Client]=Clt&&TableTotal[Country]=Ctry&&TableTotal[Year]=Annee ). Would be really nice if you can share the complete measure.

Greg_Deckler
Community Champion
Community Champion

@AnthonyJoseph This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks @Greg_Deckler 
The solution is giving me the same value across the table. Please can you help me understand, where I m going wrong.

AnthonyJoseph_0-1711528038512.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors