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
EmaVasileva
Helper V
Helper V

SUM the ABS total

Hi all,

I have a table with ID, Income and Outcome columns (both calculated measures), Difference (which is a calc.metric =ABS(Income-Outcome). 

3.png

 

 




I'd like to show the Total Difference value and I need the actual sum ot the diff values (1754), but currently with my formula Difference = ABS(Income-Outcome) the total result in PBI is 1552.

Any ideas for a working measure?

Thank you.


1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi  @EmaVasileva 

This is a measure total problem, for your case, just add a new measure as below:

Measure = 
VAR _table = SUMMARIZE('Table1',[ID],"_value",[Difference])
RETURN
SUMX(_table,[_value])

 

Regards,

Lin

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

View solution in original post

8 REPLIES 8
v-lili6-msft
Community Support
Community Support

hi  @EmaVasileva 

This is a measure total problem, for your case, just add a new measure as below:

Measure = 
VAR _table = SUMMARIZE('Table1',[ID],"_value",[Difference])
RETURN
SUMX(_table,[_value])

 

Regards,

Lin

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



I tried this but my ID column come from a different table and I cannot use the suggested formula. Any ideas? And could you specify which value should I use in the "Value" part?

Also, the measures are calculate fields, not columns, and some functions don't work.

Thank you.

hi  @EmaVasileva 

could you please share your sample pbix file for us have atest, that will be a great help.

 

Regards,

Lin

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

Hi @ 

I resolved it. The issue was with the tables relationship. After edited it, both formulas worked:


Difference_2 = SUMX(VALUES('Table 2'[ID]),IF('Table1'[Income]-Table1'[Outcome]<0, ABS('Table1'[Income]-Table1'[Outcome],ABS('Table1'[Income]-Table1'[Outcome]))     or

Difference2 = SUMX(VALUES('Table 2'[ID]), ABS('Table1'[Income]-Table1'[Outcome])


Thank you for the help and for the suggestions.

Best regards,
Ema

Gracias por la recomendación. Ya había perdido mucho tiempo y no encontraba la razón para que fallara el ABS, en mi caso de era el ABS(de dos medidas). Había que escribirlo a pie!! 

Anonymous
Not applicable

@EmaVasileva  what is the measure which  you used for sum of income and outcome...I tried replicating your issue but worked fine

Hi @HusnaBanu413,

For the Income I used CALCULATE (SUM ( 'Table1'[Income]; For the Outcome is CALCULATE (SUM ( 'Table1'[Outcome]

The first formula, which I used Is Difference = ABS(Income-Outcome) > didn't work.
I tried with Difference_2 = 
SUMX(VALUES('Table 2'[ID]),IF('Table1'[Income]-Table1'[Outcome]<0, ABS('Table1'[Income]-Table1'[Outcome],ABS('Table1'[Income]-Table1'[Outcome]))  > work only in some cases, where the Outcome is not 0.

Thank you.

 
Greg_Deckler
Super User
Super User

@EmaVasileva 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...

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