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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Tito
Helper IV
Helper IV

Sum positive values of another measure

Hello everyone,

I would like to write a measure where it calculates the sum of only the positive values of other measure.

Thank you very much for your support.

Best regards
Tito



 

∆ Sales (positive) = 
VAR SalesPrev = 
CALCULATE([Sum Sales],
    OFFSET(
        -1,
        ALLSELECTED('Table'[Date],'Table'[Product]),
        ORDERBY('Table'[Date]),
        DEFAULT,
        PARTITIONBY('Table'[Product])
    )
)
VAR Sales2 = IF(NOT ISBLANK(SalesPrev), [Sum Sales] - SalesPrev)

RETURN
CALCULATE(
    SUMX(
        'Table',
        IF(Sales2 > 0, Sales2, BLANK())
    ),
    FILTER(
        'Table',Sales2 > 0
    )
)

 


Rsult

Data_Result.PNG


 

1 ACCEPTED SOLUTION

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1713337537209.png

 


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

View solution in original post

12 REPLIES 12
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


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

Hi @Ashish_Mathur 

 

Data:

 

Data1.png

 

Rsult:

 

Result.png

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1713337537209.png

 


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

Hi,
Thank you very much for your support, it has helped me a lot.

I need to do some more calculations, could you please help me further. The result should look like the picture below.


Data:

Data new.PNG


 Result:

Result new.PNG


Best regards
Tito

I have already got the result you wanted.  Replicate the same logic for the other measures as well. 


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

Hi @Ashish_Mathur ,
Thank you very much. It has worked.

Best regards
Tito

You are welcome.


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

Hi @Ashish_Mathur 
Can you please show me how to split a .pbix file? Thank you

Best regards

Tito
Helper IV
Helper IV

Hi @PijushRoy , 
Can you help me please? 

Anonymous
Not applicable

Hi @Tito ,

I tried to get what you mean and I also want to create a .pbix file to satisfy your requirements, but I can not do that. Can you provide me your .pbix file or more details about your problems? 

It seems that [Sum Sales] is a measure, so please tell me more things about it.

vyilongmsft_0-1713322607967.png

 

 

 

Best Regards

Yilong Zhou

Hi @Anonymous ,

Data

Data1.png

 

Result:

Result.png

Hi @Anonymous 
Can you please show me how to split a .pbix file? Thank you

Best regards

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors