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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
kb177
Helper II
Helper II

need variable dates in dax query for power automate

I'm trying to make the dax dynamic related to dates, I have a filter for  all pages which shows data for previous month only and when I'm using the dax using performance analyzer then dax is static where in the date can't be changed

 

but I want the date to refer previous month instead of hard coding the dates in the dax

Is there any way to make the red in dynamic so that data can be retrieved based on month 

 

// DAX Query
DEFINE

VAR __DS0FilterTable =
FILTER(
KEEPFILTERS(VALUES('Calendar'[Date])),
AND('Calendar'[Date] >= DATE(2022, 9, 1), 'Calendar'[Date] < DATE(2022, 10, 1))
)

VAR __DS0Core =
CALCULATETABLE(
SUMMARIZE(
'Column names
),
KEEPFILTERS(__DS0FilterTable)
)

VAR __DS0PrimaryWindowed =
TOPN(
501,
__DS0Core,
column name ,
1,
'column name,
1
)

EVALUATE
__DS0PrimaryWindowed

ORDER BY
'column1,
'column2

 

 

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @kb177 ,

 

Please try:

VAR __DS0FilterTable =
FILTER(
KEEPFILTERS(VALUES('Calendar'[Date])),
AND('Calendar'[Date] >= EOMONTH(TODAY(),-2) + 1, 'Calendar'[Date] < EOMONTH(TODAY(),-1) + 1)
)

Best Regards,
Gao

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

View solution in original post

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @kb177 ,

 

Any update?🙂

 

Best Regards,
Gao

Community Support Team

v-cgao-msft
Community Support
Community Support

Hi @kb177 ,

 

Please try:

VAR __DS0FilterTable =
FILTER(
KEEPFILTERS(VALUES('Calendar'[Date])),
AND('Calendar'[Date] >= EOMONTH(TODAY(),-2) + 1, 'Calendar'[Date] < EOMONTH(TODAY(),-1) + 1)
)

Best Regards,
Gao

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors