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
Julia_Mav
Helper II
Helper II

Calculate and two filters

Hi all,

I want to get the values of yesterday's sales from country USA. To do that, I tried the measure below:

 

For yesterday =

CALCULATE(

    [Sales USD],

    FILTER (

        ALL ( 'TY Group'[Country],'TY Group' [Calendar Day] ),

        'TY Group'[Country]="USA" || 'TY Group'[Calendar Day]  = TODAY()-1))

 

But only the first (Country) filter worked and had the sum of sales for the all period.

 

Could anyone help me with this?

Thanks in advance.

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

@Julia_Mav Maybe:

For yesterday =

CALCULATE(

    [Sales USD],

    FILTER (

        ALL ( 'TY Group'[Country],'TY Group' [Calendar Day] ),

        'TY Group'[Country]="USA" && 'TY Group'[Calendar Day]  = TODAY()-1))

However, if you are using a single table data model, you may be running into issues with CALCULATE. What is the formula for your [Sales USD] measure?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Anonymous
Not applicable

Hi Julia_Mav

 

I guess, I would try to use && instead of ||. At the moment your DAX formula is just considering one of the two criterias.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi Julia_Mav

 

I guess, I would try to use && instead of ||. At the moment your DAX formula is just considering one of the two criterias.

Thank you @Anonymous, it's working now! 

Greg_Deckler
Community Champion
Community Champion

@Julia_Mav Maybe:

For yesterday =

CALCULATE(

    [Sales USD],

    FILTER (

        ALL ( 'TY Group'[Country],'TY Group' [Calendar Day] ),

        'TY Group'[Country]="USA" && 'TY Group'[Calendar Day]  = TODAY()-1))

However, if you are using a single table data model, you may be running into issues with CALCULATE. What is the formula for your [Sales USD] measure?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you @Greg_Deckler!!! It works now. 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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