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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
evester
Helper II
Helper II

How do you show negative number in matrix without subtracting from the total

@ links to members, content

Hello, I am not sure how to write DAX for my calculation needed in a matrix.  I am showing figures within a group some of the figures are negative numbers.  It appears the matrix will add all the numbers and then subtract the negative value from the total.  This is not what I want.  I want to show the negative value but I do not want the negative value to be subtracted from the positive values. 

Here is my sample 

Fund TypeSegment Donor FlowYearSum of DonorsColumn1     The total comes out as 20465 which is not correct.  The matrix is totaling all positive numbers and then subtracting the negative number in red.  I would also like to highlight the negative numbers in red in the matrix.                     

26582 This is the correct total I want to see in the Matrix

GeneralHoustonKeep20217877 
GeneralHoustonLess20213927 
GeneralHoustonLift20216773 
GeneralHoustonLost2021-6117 
GeneralHoustonWin20215662 
GeneralHoustonWin-Back20212343 
1 ACCEPTED SOLUTION

Hi,

These measures work

D = sum(Data[Donors])
Measure = if(ISINSCOPE(Data[Year]),[D],SUMX(FILTER(Data,[D]>0),[D]))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
evester
Helper II
Helper II

Sample Data

 

Fund        Segment   Flow         Year      Donor

General    Houston    Keep        2021      7877

General    Houston    Less          2021      3927

General    Houston    Lift            2021      6773

General    Houston    Loss          2021     -6117

General    Houston    Win           2021      5662

General    Houston   Win-back   2021       2343

Total                                                         20465 Wrong Total 

 

Correct Total should be 26,582

Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with (in a format that can be pasted in an MS Excel file).  At the very least, ensure that the columns have proper headings.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello, I am not sure how to write DAX for my calculation needed in a matrix.  I am showing figures within a group some of the figures are negative numbers.  It appears the matrix will add all the numbers and then subtract the negative value from the total.  This is not what I want.  I want to show the negative value but I do not want the negative value to be subtracted from the positive values. 

Here is my sample 

Fund TypeSegment Donor FlowYearSum of DonorsColumn1     The total comes out as 20465 which is not correct.  The matrix is totaling all positive numbers and then subtracting the negative number in red.  I would also like to highlight the negative numbers in red in the matrix.     

 

Sample Data

 

Fund        Segment   Flow         Year      Donor

General    Houston    Keep        2021      7877

General    Houston    Less          2021      3927

General    Houston    Lift            2021      6773

General    Houston    Loss          2021     -6117

General    Houston    Win           2021      5662

General    Houston   Win-back   2021       2343

Total                                                         20465 Wrong Total 

 

Correct Total should be 26,582

Hi,

These measures work

D = sum(Data[Donors])
Measure = if(ISINSCOPE(Data[Year]),[D],SUMX(FILTER(Data,[D]>0),[D]))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Ashish, 

The measure works, however, it removes by negative number.  I would like for my negative number to show in the matrix. 

Ashish, 

Thank you for your assistance.  I got it to work by changing the Year filter to Donor Flow.  

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

 

Sample Data

Fund        Segment  Flow          Year    Donors

GeneralHoustonKeep20217877 
GeneralHoustonLess20213927 
GeneralHoustonLift20216773 
GeneralHoustonLost2021-6117 
GeneralHoustonWin20215662 
GeneralHoustonWin-Back20212343 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.