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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
sstasche
Frequent Visitor

variable for today's date

I'm trying to filter on a data set to have the date always be greater than or equal to the current date.  Is there a variable that I can use, like 'DATE' or something like that?

Thanks!

1 ACCEPTED SOLUTION

Ah. You are in Power Query. The language used there is called "M", not DAX...no matter, we can make this right. Instead of TODAY(), use DateTime.LocalNow() where you edited it in the formula (you were on the right track) and all should be good. And you need to make sure that you balance the paranthesis, see error message in the pic you attached.

View solution in original post

6 REPLIES 6
KalerDev
New Member

Hello

This works for me too - How do I add a number of days to today's date

 

I only want the data that is before today + 4 weeks (28 days)
or anything between today + 21 days and today + 28 days

 

I am using Date.AddDays (https://docs.microsoft.com/en-us/powerquery-m/date-adddays) but I get a SyntaxError (Expression.SyntaxError: Token RightParen expected.) and not sure how / where to fix

 

[Planned_Receipt_Date_Line] < (Date.AddDays(DateTime.LocalNow()), 28))

 

 

Thanks for your feedback


KalerDev

erik_tarnvik
Solution Specialist
Solution Specialist

In DAX, TODAY() should do the trick.

I did try that, but I must be using it incorrectly. In the query editor, I am trying to create a dynamic filter to filter the column to everything after the current date:dynamic date filter error.jpg 

 

So I tried to just enter a real date and tweak the DAX, but still didn't get it right (I had changed the column from date/time to date first):

dynamic date filter error 2.jpg

 

Thanks for any help you can provide!

Ah. You are in Power Query. The language used there is called "M", not DAX...no matter, we can make this right. Instead of TODAY(), use DateTime.LocalNow() where you edited it in the formula (you were on the right track) and all should be good. And you need to make sure that you balance the paranthesis, see error message in the pic you attached.

That worked perfectly!  Thank you for the solution - and for the clarification between DAX and Power Query.  Still very new to this, and have a lot of learning to do!  Smiley Happy

My pleasure!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.