cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MDMC
New Member

Incorrect Total from Measure Incorrect

Hi, I'm new to DAX and PowerBI.  I have a fairly simple measure but cannot seem to get it to work.  Any help would be appreciated!

I am working in a live data model so I am limited to creating measures.  I have the following measure:

Active =
VAR TotalSpare = CALCULATE(SUM('table'[QuantityValue]), 'table'[Type] = 1 ||'table'[Type] = 3 
RETURN
IF([Recommended]<= TotalSpare, [Recommended], TotalSpare)
 
"Recommended" is another measure.  I cannot get the correct total, even though the line totals are correct.  At one point I added SUMX function prior to the IF statement, but got the same result.  
 2020-01-20_21-19-38.png
1 ACCEPTED SOLUTION

Accepted Solutions
JustJan Resolver IV
Resolver IV

Re: Incorrect Total from Measure Incorrect

Hi @MDMC ,

 

The grand totals line is not calculated from the table above, but is recalculated at the grand total line. So the filter conditions for the measure calculation are different in that case. 

 

Try something like this: 

 

=IF(HASONEVALUE(Table[Category])
,[Active]
,SUMX(SUMMARIZE(VALUES(Table[Category]),Table[Category],"NumberOfActives",[Active]),[NumberOfActives])
)

 

basically it tells the measure to use your [Active] measure when one line level and when on the grand total line Summarize the values of [Active]. I referred to the first blurred column as Table[Category].

 

Hope this helps.

 

Jan 

if this is a solution for you, don't forget to mark it as such. thanks

 

View solution in original post

2 REPLIES 2
JustJan Resolver IV
Resolver IV

Re: Incorrect Total from Measure Incorrect

Hi @MDMC ,

 

The grand totals line is not calculated from the table above, but is recalculated at the grand total line. So the filter conditions for the measure calculation are different in that case. 

 

Try something like this: 

 

=IF(HASONEVALUE(Table[Category])
,[Active]
,SUMX(SUMMARIZE(VALUES(Table[Category]),Table[Category],"NumberOfActives",[Active]),[NumberOfActives])
)

 

basically it tells the measure to use your [Active] measure when one line level and when on the grand total line Summarize the values of [Active]. I referred to the first blurred column as Table[Category].

 

Hope this helps.

 

Jan 

if this is a solution for you, don't forget to mark it as such. thanks

 

View solution in original post

MDMC
New Member

Re: Incorrect Total from Measure Incorrect

That worked!  Thank you so much!

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors