Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
I am working on DAX to create the paginated report and new to DAX query. I need to get the list of all orders where it's due > 2 weeks from now.
In sql, I can use this command DATEADD(DAY, + 14, GETDATE()), but I am not sure what is the correct way in DAX. I hope that you can help me with this. Thanks
EVALUATE SUMMARIZECOLUMNS (
'Backlog'[Due Date],
'Backlog'[Order Number],
FILTER ( 'Backlog','Backlog'[Due Date]>= DATEADD(DAY, + 14, GETDATE())
)
Solved! Go to Solution.
Hi @kt3734
In DAX, you can use TODAY() or UTCTODAY().
TODAY() returns the current date in the timezone of the server running DAX, which is UTC in the Power BI Service, but could be different when executed locally.
Also, you can add integers to date, with one day correponding to a value of 1.
For your specific query, I would also recommend applying a filter on the Due Date column rather than the entire table. You could also use variables for readability if you want. Something like this:
EVALUATE
VAR DateThreshold =
TODAY () + 14
VAR DateFilter =
FILTER (
ALL ( 'Backlog'[Due Date] ),
'Backlog'[Due Date] >= DateThreshold
)
RETURN
SUMMARIZECOLUMNS (
'Backlog'[Due Date],
'Backlog'[Order Number],
DateFilter
)
Regards,
Hi @kt3734
In DAX, you can use TODAY() or UTCTODAY().
TODAY() returns the current date in the timezone of the server running DAX, which is UTC in the Power BI Service, but could be different when executed locally.
Also, you can add integers to date, with one day correponding to a value of 1.
For your specific query, I would also recommend applying a filter on the Due Date column rather than the entire table. You could also use variables for readability if you want. Something like this:
EVALUATE
VAR DateThreshold =
TODAY () + 14
VAR DateFilter =
FILTER (
ALL ( 'Backlog'[Due Date] ),
'Backlog'[Due Date] >= DateThreshold
)
RETURN
SUMMARIZECOLUMNS (
'Backlog'[Due Date],
'Backlog'[Order Number],
DateFilter
)
Regards,
Thank your for your help.
User | Count |
---|---|
47 | |
26 | |
22 | |
17 | |
15 |
User | Count |
---|---|
53 | |
34 | |
17 | |
17 | |
15 |