Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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..

  • Hi,

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

    thanks.

     

     

    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 

     

     

     

1 Reply

  • Hi,

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

    thanks.

     

     

    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