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

Generating YYYYMMDD parameter table

I am trying to create a table that generates all dates from 2018-2025 using YYYYMMDD formatting. 
 
My current formula for the table is: GENERATESERIES(20180100, 20251231, 1)
 
How do I exclude all of the numbers which don't make sense (days > 31).
3 REPLIES 3
iblock
Frequent Visitor

I  need the column for a parameter, so it automatically creates using the generateseries.

CalebR
Resolver I
Resolver I

Since you are creating this table, can you just filter them out after its creation? For example, create a new custom column that extracts the two digits far right on the date. So for 20251238 the result would be 38. Then add another column that looks at your extracted date (the 38 column) and IF its greater than 31 return "Invalid date". If its less, then "Valid Date". 

Then just filter your table to "Valid Dates only".

This is just a rough idea because ive never had to do this myself before. But couldnt this also be accomplished using the Calendar function instead? That way it never generates an invalid date to begin with? Check this out: https://learn.microsoft.com/en-us/dax/calendar-function-dax

andhiii079845
Super User
Super User

Why you do not use calendar(Startdate,enddate) and than add a new column with YYYYMMDD:
VALUE(FORMAT(Table[Column]; "YYYYMMDD"))

It is easier.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.