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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Calculating measures

I'm trying to calculate a measure e.g Total Profit = Calculate(Sum('Salesdata'[Profit]), ('Salesdata' [State] = "Vic")). I've realised that have some of the data has negative values ie (Loss). I want to sum all the Total Profit in a new measure with only profit values >0. I want to exclude all the 'loss' values as it affects my new measure by decreasing the total amount. 

 

I have used this formula
Total Profit =
VAR profit = Calculate(Sum('Salesdata'[Profit]), ('Salesdata' [State] = "Vic"))

RETURN (profit>0) 
Please help..

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data mode looks like, but please try to create the measure similar to the below.

thanks.

 

Picture1.png

 

Total Profit only positive and Vic : =
VAR _newtable =
FILTER ( Salesdata, Salesdata[Profit] > 0 && Salesdata[State] = "Vic" )
RETURN
SUMX ( _newtable, Salesdata[Profit] )

 

 

 

Link to the sample pbix file 

 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data mode looks like, but please try to create the measure similar to the below.

thanks.

 

Picture1.png

 

Total Profit only positive and Vic : =
VAR _newtable =
FILTER ( Salesdata, Salesdata[Profit] > 0 && Salesdata[State] = "Vic" )
RETURN
SUMX ( _newtable, Salesdata[Profit] )

 

 

 

Link to the sample pbix file 

 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Helpful resources

Announcements
FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.