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
julesdude
Post Partisan
Post Partisan

Getting Correct Grand Totals Following Measure Column

Hi there,

I've had some valuable help here building the following DAX measure that will provide me with totals based on conditions to achieve this:

julesdude_0-1659439081011.png

 

DAX measure is:

Measure = 

VAR _0 = LASTDATE ( 'Table'[Date] )
VAR _1 = CALCULATE ( LASTDATE( 'Table'[Date] ) , ALLEXCEPT ( 'Table' ,'Table'[Country] ,'Table'[Asset Reference] ) )
VAR _2 = IF ( _1 = _0 , SUM ('Table'[Amount] ) , BLANK() )

RETURN

_2

 

However, as you can see in the total in the table above, it's not a reflection of what is in the column.

 

How can I achieve this?

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@julesdude This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

Hi @julesdude 

where exactly is the problem. I failed to spot tge error!

Hi @tamerj1 
In the top table of the screenshot I pasted, far right column 'Measure New', the values the measure is displaying aren't adding up to the Total displayed. 
That means it's a problem for the pie chart I'm compiling underneath as the figures in that pie chart aren't actually representative of the table above it. The table beneath the pie chart is basically the same data but in a table, to illustrate it another way.

So, I'm hoping for a solution around this common problem.

@julesdude 

Sorry I was so busy yesterday I diyhave the chance to look into this. Can you please describe in works what this measure is intended to calculate? Thank you

Hi @tamerj1 thanks for responding.

I managed to get the example in post Greg posted to work for me.

Greg_Deckler
Super User
Super User

@julesdude This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 

Many thanks for the valuable link and your post. The Final Word worked brilliantly and I shall refer to this in future whenever i hit this issue. 

I added to the above code creating a new measure which references my original measure, and it is this new measure that the visualisation now uses directly,

Thanks again

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.

Top Solution Authors