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

Dax measure not returning the correct aggregate result

Hi,

 

I created this measure shown below that returns a table with correct row values:

sivarajan21_0-1715879627103.png

But the aggregate total -3036.53 is not correct  and correct total we need is -1145.19.

Could you please help me as what needs to be corrected in the above measure for the correct total?

 

PFA file here Portfolio Performance - v2.12 - Copy (2).pbix

 

Thanks in advance!

@Ahmedx @Greg_Deckler @marcorusso @amitchandak @v-jianpeng-msft 

2 ACCEPTED SOLUTIONS
jdbuchanan71
Super User
Super User

@sivarajan21 

Try it using TOPN instead.

Budget Carbon Variance Bottom 20 v2 = 
 VAR _TopN = TOPN(10,ALL(Contacts[Name]),[Budget Carbon Variance],ASC)
  RETURN
CALCULATE([Budget Carbon Variance],KEEPFILTERS(_TopN))

jdbuchanan71_0-1715881539929.png

 

View solution in original post

Ahmedx
Super User
Super User

4 REPLIES 4
Ahmedx
Super User
Super User

pls try this

Screenshot_1.png

Greg_Deckler
Super User
Super User

@sivarajan21 First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

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

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
jdbuchanan71
Super User
Super User

@sivarajan21 

Try it using TOPN instead.

Budget Carbon Variance Bottom 20 v2 = 
 VAR _TopN = TOPN(10,ALL(Contacts[Name]),[Budget Carbon Variance],ASC)
  RETURN
CALCULATE([Budget Carbon Variance],KEEPFILTERS(_TopN))

jdbuchanan71_0-1715881539929.png

 

Arul
Super User
Super User

@sivarajan21 ,

I am unable to download the file, but please refer to these two videos. They should help you understand the context behind the Grand Total issue and its solution.

https://www.youtube.com/watch?v=yw0QHu9V4UQ

https://www.youtube.com/watch?v=ufHOOLdi_jk&app=desktop&ab_channel=Curbal





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Helpful resources

Announcements
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!

Jan NL Carousel

Fabric Community Update - January 2025

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