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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bkennedype
Frequent Visitor

CALCULATETABLE with 2 filters

New to Power BI and struggling a little bit with syntax.  I'm not a programmer but could easily do this with a regular SQL query.

 

Here is my CALCULATETABLE query - it uses a measure to filter what I need, but I need to add a second filter.

 

Events7Days = filter(CALCULATETABLE(ALL('pip Events')),'pip Events'[End_Date]>=DateTable[7DaysAgo])

 

7DayAgo is a measure that I added to my DateTable.  The rows with "0" are the rows I want to filter but I can't figure out how to add a second filter to this.

 

2018-05-17_2117.png

 

Any help would be appreciated.

 

Thanks

 

 

 

 

1 ACCEPTED SOLUTION
Phil_Seamark
Employee
Employee

Hi @bkennedype

 

Have you tried...

 

Events7Days = 
    filter(
        CALCULATETABLE(
            ALL('pip Events')
            ),
            'pip Events'[End_Date]>=DateTable[7DaysAgo] && 
            'pip Events'[Draw_ID] = 0
            )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
Phil_Seamark
Employee
Employee

Hi @bkennedype

 

Have you tried...

 

Events7Days = 
    filter(
        CALCULATETABLE(
            ALL('pip Events')
            ),
            'pip Events'[End_Date]>=DateTable[7DaysAgo] && 
            'pip Events'[Draw_ID] = 0
            )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

That works.....once I change the = 0 to <> 0

 

Events7Days = filter( CALCULATETABLE( ALL('pip Events') ), 'pip Events'[End_Date]>=DateTable[7DaysAgo] && 'pip Events'[Draw_ID] <> 0 )

 

Thanks for your help.  I now see how to add multi-filters

Hi @bkennedype

 

Well done!  I wasn't sure if you wanted to keep the zeros or get rid of them. I figure you could tweak the pattern to suit. 🙂


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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