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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
srbs
New Member

Not able to calculate grand total with dax correctly

Greetings, I have a table of positive and negative numbers,

All of the numbers are summed into rows as follows,

srbs_2-1699260748484.png

 

All I want is to have % of total of these lines, where it would divide all these individual codes by total sum of codes <599, to basically see impact of these individual codes to the overall results of codes under 599

 

What I would like it to look like is 

 

CodeGrand total SUMGrand total dax
50017861649.8720823336.44
5012053807.9120823336.44
504506468,0020823336.44
503

366718.61

20823336.44
532

34692.05

20823336.44

 

Since there are positive and negative numbers in this list, the % of total function in calculation returns nonsensicle percentages, as stated in the 4th collumn

 

These are the DAX commands I am using,

Grand total SUM = SUMX('power bi test','power bi test'[sum])
Grand total dax = CALCULATE(sum('power bi test'[sum]),FILTER('power bi test','power bi test'[Code]<599))
 
I also tried replacing the FILTER with ALLSELECTED, same result
 
This is driving me crazy and already wasted huge amounts of my time,
Can anyone help me with this?
 
1 ACCEPTED SOLUTION
ERD
Community Champion
Community Champion

Hi @srbs , try these measures (almost same, just a little different):

_Grand total SUM = SUM(t[Grand total SUM])
Grand total dax = CALCULATE ( SUM ( t[Grand total SUM] ), t[Code] < 599, ALL ( t ) )

ERD_0-1699264780210.png

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

3 REPLIES 3
ERD
Community Champion
Community Champion

Hi @srbs , try these measures (almost same, just a little different):

_Grand total SUM = SUM(t[Grand total SUM])
Grand total dax = CALCULATE ( SUM ( t[Grand total SUM] ), t[Code] < 599, ALL ( t ) )

ERD_0-1699264780210.png

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

That works indeed, thank you,

 

I think I solved it aswell on my own with one uneccesary extra step 

= CALCULATETABLE('power bi test','power bi test'[Code]<599),[Grand total SUM]))
 
Cheers!
srbs
New Member

And I wanted to mention that I overlooked like 10 different youtube videos on the matter and the solutions work there but not in my dax for some reason

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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