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
Sarahparker2
Frequent Visitor

Can sum negaitive values

I have a list of account balances both positive and negaitive. The account balance is calculated using a measure, i then would like to sum only the negative values and display by account type. When i do this it will only display the negative balances if the sum of the every account in the account type is negative instead of displaying the sum of all the negative values within each account type.

 

Can any one please advise.

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@Sarahparker2

 

In this scenario, to sum the negative values, you just need to filter those negative rows in your calculation. Please refer to my sample below:

 

 

 

1. Create Total measure group on Type:

Total = CALCULATE(SUM(Table1[Value]),ALLEXCEPT(Table1,Table1[Type]))

2. Create Negative Total measure:

 

Negative Total = CALCULATE(SUM(Table1[Value]),FILTER(Table1,Table1[Value]<0),ALLEXCEPT(Table1,Table1[Type]))

3. Create the conditional Total as you required:

 

Conditional Total = IF([Total]<0,[Negative Total],[Total])

The result looks like below:

 

55.PNG

 

Regards,

View solution in original post

3 REPLIES 3
v-sihou-msft
Employee
Employee

@Sarahparker2

 

In this scenario, to sum the negative values, you just need to filter those negative rows in your calculation. Please refer to my sample below:

 

 

 

1. Create Total measure group on Type:

Total = CALCULATE(SUM(Table1[Value]),ALLEXCEPT(Table1,Table1[Type]))

2. Create Negative Total measure:

 

Negative Total = CALCULATE(SUM(Table1[Value]),FILTER(Table1,Table1[Value]<0),ALLEXCEPT(Table1,Table1[Type]))

3. Create the conditional Total as you required:

 

Conditional Total = IF([Total]<0,[Negative Total],[Total])

The result looks like below:

 

55.PNG

 

Regards,

Hi,

 

Just to confirm SUM presented by "Conditional Total" will not work in this case as its measure correct ? I wanted to display conditional total from only those measures whose value is positive.

 

 

Regards

 

Digant

Thank you, this worked perfectly.

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.