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
deepanko
New Member

Need positive values from another column with aggregated/sliced values

Hi PowerBI commnity,

I am new to PowerBI and I could really appreiate your help here. So, I have a table and many slicers. Below, I have shared a snippet of my table and highlighted where I am having trouble. 

 

In the second column, I have summed the values in my PowerBI table from my excel column. In excel, this column had multiple poitive and negative value. 

 

Next I created a measure for the third column 

Measure = CALCULATE(sumx(sheet1,if(Sheet1["values"]>0,Sheet1["values"],0)))
 
So, I just want the positive values from the 2nd column to my 3rd column. The highighted pink values are not matching as there were a few negative values which according to my Measure logic did not get picked. But the green highlighted value is corect as there were no negative values.

deepanko_0-1624845263663.png

Looking forward to your help.

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

=if([measure]>0,[measure],0)

Measure is the one which is returning positive and negative values.

Hope this helps.


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

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

=if([measure]>0,[measure],0)

Measure is the one which is returning positive and negative values.

Hope this helps.


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

Thank you so much @Ashish_Mathur 

So, using a dummy variable and the measure like you suggested I was able to get the positive values from the previous columns.

This is what i did:

Dummy = sum(Sheet1[I just want positive values from the previous column]) idea I got from (@karimkz - https://community.powerbi.com/t5/Desktop/IF-statement-in-Measure-need-help/m-p/135388)

Measure = IF([Dummy]>0,[Dummy],0) 


And now I have another issue. I am not getting the correct totals for the Measure column.
 I have attached the screenshot below. So, I came aross another one of your answer @Ashish_Mathur  where i tried to create 
Measure 2 = SUMX(VALUES(Sheet1[I just want positive values from the previous column]),[Measure])
However, due to my inexperience, I am not able to get this logic. And the highlighted values in pink are wrong. I just want the sum of the green values.
 
deepanko_0-1624853397331.png

 

Really appreciate your help and thank you in advance.

Hi,

Try this

=SUMX(VALUES(DATA[Grouped By]),[Measure])

Hope this helps.


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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.