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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
v-yaningy-msft
Community Support
Community Support

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
v-yaningy-msft
Community Support
Community Support

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
Post Prodigy
Post Prodigy

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.