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
koolsid786
Frequent Visitor

M Query - List.Dates(#date(2020,05,31), 365, #duration(1,0,0,0))

Hello Team,

 

Can someone help me understanding how the above command will work and if in Duration (1,0,0,0) if I replace 1 by 2 or 3 what will happen ? 

 

My understanding  - above will create a column with date starting from May 31, 2020 and will last till 1 year and will have date as May 31, 2020 , June 1, 2020, June 2, 2020 etc.. as the duration has 1 day  if I change it to 2 it would be May 31, 2020, June 2, 2020, June 4, 2020 

 

Is the understanding correct ? 

2 ACCEPTED SOLUTIONS
m_dekorte
Super User
Super User

Hi @koolsid786 

 

For the most part your assumptions are right. It will create a list with dates starting May 31, 2020

The second argument is a count and the third step as duration. When you incease the step from 1 to 2 days a list will be generated with 365 list items, making the end date or last list item May 5, 2022 

 

Please mark this answer as solution when it helped you to resolve your question, thanks!

View solution in original post

4 REPLIES 4
ppm1
Solution Sage
Solution Sage

Your explanation is correct. The first value in #duration is days. Also, FYI that people typically use this approach to dynamically get the right count to make sure they get 1 year (leap year, etc.).

 

= List.Dates(#date(2020,05,31), Duration.TotalDays(#date(2021,6,1)-#date(2020,5,31)), #duration(1,0,0,0))

 

Pat

Microsoft Employee
m_dekorte
Super User
Super User

Hi @koolsid786 

 

For the most part your assumptions are right. It will create a list with dates starting May 31, 2020

The second argument is a count and the third step as duration. When you incease the step from 1 to 2 days a list will be generated with 365 list items, making the end date or last list item May 5, 2022 

 

Please mark this answer as solution when it helped you to resolve your question, thanks!

@m_dekorte  why the end date would be May 5, 2022

See here

m_dekorte_0-1682234256819.png

 

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
Top Kudoed Authors