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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Marango
Regular Visitor

Measures using filters of negative and positive results

Hello,

would like to know how can I make measures  with calculations but using filters. here is an example of what I pretend to do

I have the sales per country on 2023 and 2024.  I am comparing them.

so I was thinking to make a measure to show only  the countrys that has losing of sales . and another measure  that let me show only the countries having an increase of sale with no return of the negative numbers.  I think I need to make measures because at the end I need to make a comparative chart showing the losing sales and the increase of sales with the sales of previous year.

 

COUNTRY20232024Difference 
USA$5,000$4,300-$700 
FRANCE$5,000$5,000$0 
GERMANY$3,500$2,000-$1,500 
MEXICO$600$1,200$600 
ITALY$5,500$5,300-$200 
CHINA$5,000$3,000-$2,000 
JAPAN$5,000$4,580-$420 
AUSTRALIA$6,000$6,100$100 
TOTAL$35,600$31,480-$4,120 
     
NEW MEASURES   
Lost Sales  Increase of sales: 
USA-$700 MEXICO$600
GERMANY-$1,500 AUSTRALIA$100
CHINA-$2,000  $700
JAPAN-$420   
 -$4,620   
     
FINAL CHART I NEED TO ACHIEVE  
     
 2023LOST SALEINCREASE OF SALES 
 $35,600-$4,620$700 

 

thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Marango 

Thanks for @powerbiexpert22's reply. You can try this dax to achieve your need.

vyaningymsft_0-1734070174184.png

Lost Sale = 
CALCULATE(SUM('Table'[2023])- SUM('Table'[2024]),FILTER('Table','Table'[2023]>'Table'[2024]))

Increase of sales = 
CALCULATE(SUM('Table'[2023])- SUM('Table'[2024]),FILTER('Table','Table'[2023]<='Table'[2024]))

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi, @Marango 

Thanks for @powerbiexpert22's reply. You can try this dax to achieve your need.

vyaningymsft_0-1734070174184.png

Lost Sale = 
CALCULATE(SUM('Table'[2023])- SUM('Table'[2024]),FILTER('Table','Table'[2023]>'Table'[2024]))

Increase of sales = 
CALCULATE(SUM('Table'[2023])- SUM('Table'[2024]),FILTER('Table','Table'[2023]<='Table'[2024]))

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

powerbiexpert22
Impactful Individual
Impactful Individual

Hi @Marango ,

you can specify conditions in calculate which acts as filters , Calculate (function(), condition or filter)

example Calculate(sum(sales),Country="USA")

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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