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
LazyAdmin
New Member

Using multiple filters in a calculate

I am trying to combine two filters. I search the forum and I am correct the code below should work:

 

 

AmountOverdueSurveys = 
  CALCULATE(
    DISTINCTCOUNT('project-surveys'[Id]); 
    FILTER('project-surveys'; 'project-surveys'[completed_at] <= [MaxDate] && 'project-surveys'[completed_at] >= [MinDate]); 
    FILTER('project-surveys'; 'project-surveys'[status] = "overdue")
  )

 

 

The problem is that the filter for status alone is work. And the filter for between dates also. But when I combine them they don't work anymore.

 

I also tried the following:

 

AmountOverdueSurveys = 
  CALCULATE(
    DISTINCTCOUNT('project-surveys'[Id]); 
         FILTER('project-surveys'; 
                'project-surveys'[completed_at] <= [MaxDate] 
                 && 'project-surveys'[completed_at] >= [MinDate] 
                 && 'project-surveys'[status] = "overdue"); 
  )

 

But that didn't work either. 

 

What am I missing here? (and yes I am new to Power BI 😉 )

1 ACCEPTED SOLUTION
MartynRamsden
Solution Sage
Solution Sage

Hi @LazyAdmin 

 

You were almost there. Try this:

AmountOverdueSurveys =
CALCULATE(
    DISTINCTCOUNT( 'project-surveys'[Id] );
    FILTER(
        'project-surveys';
        'project-surveys'[completed_at] <= [MaxDate]
            && 'project-surveys'[completed_at] >= [MinDate]
            && 'project-surveys'[status] = "overdue"
    )
)

 

Best regards,
Martyn


If I answered your question, please help others by accepting it as a solution.

View solution in original post

3 REPLIES 3
MartynRamsden
Solution Sage
Solution Sage

Hi @LazyAdmin 

 

You were almost there. Try this:

AmountOverdueSurveys =
CALCULATE(
    DISTINCTCOUNT( 'project-surveys'[Id] );
    FILTER(
        'project-surveys';
        'project-surveys'[completed_at] <= [MaxDate]
            && 'project-surveys'[completed_at] >= [MinDate]
            && 'project-surveys'[status] = "overdue"
    )
)

 

Best regards,
Martyn


If I answered your question, please help others by accepting it as a solution.

It worked, was the same solution as my second formula. The mistake I made in the date filter is that an overdue record is never completed, so it doesn't have a complete_at date (only a scheduled date).

Hi @LazyAdmin 

 

Your 2nd DAX expression was almost there, you just had an extra semicolon on the last line of your filter expression which would have caused an error.

 

Best regards,
Martyn


If I answered your question, please help others by accepting it as a solution.

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.