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
HenrikH29
Helper I
Helper I

Wrong Sum totals when using measures in a matix

I have two measures in a matix. One showing negative values and one showing positive values. 

 

However i can't get a total in each coloumn. I one get ne total and it's the sum of both measures.

 

The measures are:

Foran = IF(CALCULATE( [Produktion 60 dg.] - [Netto IVA] )>=0;CALCULATE( [Produktion 60 dg.] - [Netto IVA]);BLANK())

and

Bagud = IF(CALCULATE( [Produktion 60 dg.] - [Netto IVA] )<0;CALCULATE( [Produktion 60 dg.] - [Netto IVA]);BLANK())

 

Udklip.JPG

 

I've Googled and found that i probably have to use SUMX or HASONEVALUE but i can't figure the syntax out.

 

Any help constructing the syntax would be appreciated.

4 REPLIES 4
himanshu56
Resolver II
Resolver II

Hi @HenrikH29

 

Please use the following DAX :

Foran = SUMX ( TableName,  IF(CALCULATE( [Produktion 60 dg.] - [Netto IVA] )>=0;CALCULATE( [Produktion 60 dg.] - [Netto IVA]);BLANK()) )

 

Similarly create for Bagud.

 

This should work...

 

Thanks,

Himanshu

Hi Himanshu

 

Thanks for your quick reply

 

The syntax dosn't generate an error, however the clculated resultats are not correct.

 

"TableName" is to be substituted with the tablename that holds the measures - right?

 

"Produktion 60 dg" is calculated this way : Produktion 60 dg. = CALCULATE(Sum(DSP_SAGPOST[Igang. arb.]);Kalender[Dato]>=TODAY()-60)

 

and Netto IVA = CALCULATE(sum(DSP_SAGPOST[Igang. arb.]))-CALCULATE(SUM(DSP_SAGFAKGEM[Aconto]))

 

This is the resulat i get using your suggestion:

Udklip.JPG

In my previous posting you can se the correct results (but with incorrect totals).

 

Any ideas?

Check out if a label works correctly. If not, try using "0" instead of BLANK to complete the areas.

Regards


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

Happy to help!

LaDataWeb Blog

Tried using "0" instead of BLANK() but wtihout any luck.

 

There's one dealing with it here, but I just can't get the syntax right trying his solution.

 

http://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/m-p/63376

 

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.