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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
kt3734
Frequent Visitor

Dax query

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())
)

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

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,


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

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,


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Thank your for your help.  

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors