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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
askspepsi
Helper II
Helper II

Power Query Start date to today

Greeting All,

 

IdStart DateDate Master
101/05/202101/05/2021
101/05/202102/05/2021
101/05/202103/05/2021
101/05/202104/05/2021
101/05/202105/05/2021
101/05/202106/05/2021
101/05/202107/05/2021
101/05/202108/05/2021
101/05/202109/05/2021
101/05/202110/05/2021
101/05/202111/05/2021
101/05/202112/05/2021
101/05/202113/05/2021
101/05/202114/05/2021
101/05/202115/05/2021
101/05/202116/05/2021
101/05/202117/05/2021
101/05/202118/05/2021
101/05/202119/05/2021
101/05/202120/05/2021
101/05/202121/05/2021
101/05/202122/05/2021
101/05/202123/05/2021
101/05/202124/05/2021
101/05/202125/05/2021
101/05/202126/05/2021
101/05/202127/05/2021
211/05/202111/05/2021
211/05/202112/05/2021
211/05/202113/05/2021
211/05/202114/05/2021
211/05/202115/05/2021
211/05/202116/05/2021
211/05/202117/05/2021
211/05/202118/05/2021
211/05/202119/05/2021
211/05/202120/05/2021
211/05/202121/05/2021
211/05/202122/05/2021
211/05/202123/05/2021
211/05/202124/05/2021
211/05/202125/05/2021
211/05/202126/05/2021
211/05/202127/05/2021

 

I have used the below query for 100days but I want to add today() function instead of 100.

Date Master=List.Dates([Start Date], 100, #duration(1, 0, 0, 0))

 

Please help to change this Query.

 

Thank you,

askspepsi

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@askspepsi 

Your formula is creating a list of dates from [Start Date] with 100 days. IF not 100 days, what exactly is required there?
Today is a Date, you a number. if you need today's date in PQ Date.From(DateTimeZone.LocalNow())

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

5 REPLIES 5
Fowmy
Super User
Super User

@askspepsi 

Your formula is creating a list of dates from [Start Date] with 100 days. IF not 100 days, what exactly is required there?
Today is a Date, you a number. if you need today's date in PQ Date.From(DateTimeZone.LocalNow())

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy 

You are correct, my formula is creating for 100days, but for time being and to make the formula work I kept as 100days, but in reality, it should take today's date for example:- one employee starts from May 1st, 2021 then the date master should have 1st May 2021 to 27th May 2021 and when it is tomorrow the date master should be 1st May 2021 to 28 May 2021.

 

As you said to use Date.From(DateTimeZone.LocalNow()),

My Formula is now working fine, Thank you.

List.Dates([Start Date], Duration.Days(Date.From(DateTimeZone.LocalNow()) -[Start Date])+1 , #duration(1, 0, 0, 0))

amitchandak
Super User
Super User

@askspepsi , Try like

Date Master=List.Dates([Start Date], Duration.Days(today() -[Start Date]) , #duration(1, 0, 0, 0))

@amitchandak 

I have got the below error

Expression.Error: The name 'today' wasn't recognized. Make sure it's spelled correctly.

@amitchandak 

Thanks for the reply,

Will today() function work in Power Query.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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