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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

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.

Anonymous
Not applicable

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
Solution Sage
Solution Sage

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.