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

Problem with filtering DAX Query - Wanting a dynamic date instead of static

Morning,

 

I'm trying to make my DAX query dynamic for getting date from SQL to a Microsoft Lists using Power Automate.

 

The part that important from my DAX query is as follows:

 

                VAR __DS0FilterTable2 =

                               FILTER(

                                               KEEPFILTERS(VALUES('OHW'[CalcDate])),

                                               AND('OHW'[CalcDate] >= DATE(2024, 1, 8), 'OHW'[CalcDate] < DATE(2024, 1, 9))

                               )

What I would like to get is that 'OHW'[CalcDate] always takes Today()-1 or Yesterday. So yesterday it was 2024,1,8 > 2024,1,9 but tomorrow I would like it to be 2024,1,9 > 2024,1,10. From what I found online I already tried to use:

VAR __DS0FilterTable2 =
FILTER(
KEEPFILTERS(VALUES('OHW'[CalcDate])),
AND('OHW'[CalcDate] >= today()-1)
)

but that's giving me errors in Power automate: Error - Action 'Run_a_query_against_a_dataset' failed.


Anyone who knows how to solve this problem?

 

1 ACCEPTED SOLUTION
SandraBudding
New Member

Already found the solution myself. For people who are looking to solve this in the future:

 

VAR __DS0FilterTable2 =
FILTER(
KEEPFILTERS(VALUES('OHW'[CalcDate])),
AND('OHW'[CalcDate] >= DATE(@{formatDateTime(utcNow(), 'yyyy,MM,dd')}), 'OHW'[CalcDate] < DATE(@{formatDateTime(addDays(utcNow(),1), 'yyyy,MM,dd')}))
)

View solution in original post

1 REPLY 1
SandraBudding
New Member

Already found the solution myself. For people who are looking to solve this in the future:

 

VAR __DS0FilterTable2 =
FILTER(
KEEPFILTERS(VALUES('OHW'[CalcDate])),
AND('OHW'[CalcDate] >= DATE(@{formatDateTime(utcNow(), 'yyyy,MM,dd')}), 'OHW'[CalcDate] < DATE(@{formatDateTime(addDays(utcNow(),1), 'yyyy,MM,dd')}))
)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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