Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Microsoft Power BI Community
- Forums
- Get Help with Power BI
- Desktop
- Sum of Negative and positive values seperately in ...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

Kalai20078

New Member

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-07-2018
02:22 AM

Hi,

I need some help on sum the Negative and Positive values within a measure seperately.

Eg. I have the following measure

Difference |

-0.4375 |

0 |

0 |

0 |

-0.2 |

0 |

0.7875 |

0.055 |

-0.77875 |

0.5 |

0.3 |

0 |

0 |

-0.8 |

-0.125 |

0.1125 |

-0.2 |

Since it a measure I have problems in using the CALCULATE or SUM or any other ways to calculate the sum, I nee to calculate only the negative values and have it in a measure then sum the psoitive values and have it in a different measure.

Result should be -254 for negative sum and 1.7 for the positive.

Please it would be great if some one could help me.

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

Zubair_Muhammad

Super User III

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-07-2018
04:05 AM

Sorry I overlooked that it is a MEASURE

Which column do you use as row field

Try this. Replace the Column with RowField

PositiveCount = SUMX ( FILTER ( ALLSELECTED ( TableName[COLUMN] ), [Difference] > 0 ), [Difference] )

Try my new Power BI game Cross the River

5 REPLIES 5

Highlighted
##

Zubair_Muhammad

Super User III

Re: Sum of Negative and positive values seperately in a Measure

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-07-2018
03:37 AM

Try this

PositiveCount = CALCULATE ( SUM ( TableName[Difference] ), TableName[Difference] > 0 )

Try my new Power BI game Cross the River

Highlighted
##

SivaMani

Solution Sage

Re: Sum of Negative and positive values seperately in a Measure

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-07-2018
03:54 AM

Hope! this is what you're looking for,

*Posstive = CALCULATE(SUM(Table1[Difference]),Table1[Difference] > 0)*

*Negative = CALCULATE(SUM(Table1[Difference]),Table1[Difference] < 0)*

Highlighted
##

Kalai20078

New Member

Re: Sum of Negative and positive values seperately in a Measure

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-07-2018
03:56 AM

@Zubair_Muhammad Thanks for your reply,

Here you mean the column

SUM ( TableName[Difference]

However mine was a measure (The difference Iam calculating is already withing a measure), I not able to use a measure here.

Highlighted
##

Kalai20078

New Member

Re: Sum of Negative and positive values seperately in a Measure

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-07-2018
04:04 AM

@SivaMani thaks for the reply

I have tried this earlier with lot other however the problem was that the difference column shown itself is a measure not the column and so it is not possible to use the measure in place of column, any other thoughts?,

I brought the negative and positive values in a speperate measures respectively but you know the total will not be the one as expecteed in a measure put up like this,, so stuck here....

Highlighted

Zubair_Muhammad

Super User III

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-07-2018
04:05 AM

Sorry I overlooked that it is a MEASURE

Which column do you use as row field

Try this. Replace the Column with RowField

PositiveCount = SUMX ( FILTER ( ALLSELECTED ( TableName[COLUMN] ), [Difference] > 0 ), [Difference] )

Try my new Power BI game Cross the River

Announcements

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Visit our Community Blog for articles, guides, and information created by fellow community members.

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Top Solution Authors

User | Count |
---|---|

373 | |

131 | |

96 | |

92 | |

90 |

Top Kudoed Authors

User | Count |
---|---|

479 | |

185 | |

181 | |

138 | |

120 |