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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
singh_gagan30
Helper I
Helper I

I want to sum positive values and negative values separately from a measure

Hi All,

 

I have a measure in which I have positive and negative values which is achieved after perfroming a difference in 2 already existing measures. I want to add them separately and then take the percentage accordingly.

 

Please refer to the sample below:

 

singh_gagan30_0-1594717948974.png

 

TIA

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @singh_gagan30 ,

 

 

You can try this measure

 

Share % = 
var negativesum = IF ([Measure 4] < 0 ,CALCULATE(SUMX(FILTER(ALL('Table'),[Measure 4]<0),[Measure 4])))
var Positivesum = IF ([Measure 4] > 0 ,CALCULATE(SUMX(FILTER(ALL('Table'),[Measure 4]>0),[Measure 4])))
RETURN

If ([Measure 4] > 0 , DIVIDE([Measure 4],Positivesum), DIVIDE([Measure 4],negativesum))

 

 

1.jpg

 

 

Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

View solution in original post

4 REPLIES 4
harshnathani
Community Champion
Community Champion

Hi @singh_gagan30 ,

 

 

You can try this measure

 

Share % = 
var negativesum = IF ([Measure 4] < 0 ,CALCULATE(SUMX(FILTER(ALL('Table'),[Measure 4]<0),[Measure 4])))
var Positivesum = IF ([Measure 4] > 0 ,CALCULATE(SUMX(FILTER(ALL('Table'),[Measure 4]>0),[Measure 4])))
RETURN

If ([Measure 4] > 0 , DIVIDE([Measure 4],Positivesum), DIVIDE([Measure 4],negativesum))

 

 

1.jpg

 

 

Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

amitchandak
Super User
Super User

@singh_gagan30 , formula for share %. Can you share sample data and sample output in table format?

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Pragati11
Super User
Super User

Hi @singh_gagan30 ,

 

Can you please specify, how you achieve this percentage value in "% share" column?

Your comments column doesn't make sense.

 

Write a proper example with values you are using to calculate the percentage.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

I added all the negative values and a denominator and numerator is row wise. for negative values i divided the negative row values to the dnominator and similary process for the positive values.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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