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
Anonymous
Not applicable

My Date Dimension table is excluding today's date!

In Power Query I have appended my data tables, kept the date columns, merged them into a single column and de-duplicated it - keeping a list of all the dates in my data. This table is called 'Date'. It happens to include data from today.

 

Next, I created a date list using the MIN and MAX of the 'Date' table, and this list contains every single day between the min and max dates in my dataset. 

 

However, the m query I stole from a website seems to remove today's date (or the max date in the 'Date' table), and whenever I play with the code, it breaks my list. 

 

Below is my code, can you please help me include todays date? (or - the max date in the 'date' table - not sure which is causing the issue)

 

= List.Dates(List.Min(Date[DATE]),Duration.Days(List.Max(Date[DATE])-List.Min(Date[DATE])),#duration(1,0,0,0))

 

1 ACCEPTED SOLUTION
bcdobbs
Super User
Super User

You need to add 1 to the second parameter...

= List.Dates(List.Min(Date[DATE]),Duration.Days(List.Max(Date[DATE])-List.Min(Date[DATE])+1),#duration(1,0,0,0))

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

4 REPLIES 4
bcdobbs
Super User
Super User

You need to add 1 to the second parameter...

= List.Dates(List.Min(Date[DATE]),Duration.Days(List.Max(Date[DATE])-List.Min(Date[DATE])+1),#duration(1,0,0,0))

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Anonymous
Not applicable

Hi @bcdobbs THANK YOU!! I had to make a minor amendment to your code, but this works! 😁

 

= List.Dates(List.Min(Date[DATE]),Duration.Days(List.Max(Date[DATE])-List.Min(Date[DATE]))+1,#duration(1,0,0,0))

 

Glad it works, sorry for clumsy thumbs on a phone!



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Take simple case:

3rd Jan - 2nd Jan = 1 because it compares both at midnight.

 

You then start a day list starting on 2nd Jan with 1 day in it so you only get 2nd Jan.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

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.