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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
spandy34
Responsive Resident
Responsive Resident

DAX Month Date Table

How would I create a date table in Dax that lists the start date and end date of each month from 01/07/2007 to 31/12/2099 similar to the format below?  Thank you in advance

 

spandy34_0-1693848281422.png

 

@amitchandak @tamerj1 @danextian @goncalogeraldes 

4 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @spandy34 

please try

Month Date =
VAR MinDate =
DATE ( 2007, 7, 1 )
VAR MaxDate =
DATE ( 2099, 12, 31 )
VAR Months =
DATEDIFF ( MinDate, MaxDate, MONTH )
VAR T1 =
GENERATESERIES ( 0, Months, 1 )
RETURN
SELECTCOLUMNS (
T,
"StartDate", EDATE ( Mindate, [Value] ),
"EndDate", EOMONTH ( MinDate, [Value] )
)

View solution in original post

@spandy34 

Sorry its a typo in the variable name

Month Date =
VAR MinDate =
DATE ( 2007, 7, 1 )
VAR MaxDate =
DATE ( 2099, 12, 31 )
VAR Months =
DATEDIFF ( MinDate, MaxDate, MONTH )
VAR T =
GENERATESERIES ( 0, Months, 1 )
RETURN
SELECTCOLUMNS (
T,
"StartDate", EDATE ( Mindate, [Value] ),
"EndDate", EOMONTH ( MinDate, [Value] )
)

View solution in original post

Anonymous
Not applicable

Hi  @spandy34 ,

 

Here are the steps you can follow:

1. Create calculated table.

Table =
var _table1=
CALENDAR(
    DATE(2007,1,1),
    DATE(2099,12,31))
var _table2=
ADDCOLUMNS(
    _table1,"Enddate",EOMONTH([Date],0))
return
FILTER(
    _table2,   [Date]=MINX(FILTER(_table2,YEAR([Date])=YEAR(EARLIER([Date]))&&MONTH([Date])=MONTH(EARLIER([Date]))),[Date]))

2. Result:

vyangliumsft_0-1693968866367.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

tamerj1
Super User
Super User

@spandy34 
Please refer to attached sample file with the solution

1.png

Month Date = 
VAR MinDate =
    DATE ( 2007, 7, 1 )
VAR MaxDate =
    DATE ( 2099, 12, 31 )
VAR Months =
    DATEDIFF ( MinDate, MaxDate, MONTH )
VAR T =
    GENERATESERIES ( 0, Months, 1 )
RETURN
    SELECTCOLUMNS (
        T,
        "StartDate", EDATE ( Mindate, [Value] ),
        "EndDate", EOMONTH ( MinDate, [Value] )
    )

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Hi  @tamerj1 ,

 

Sorry, this was an oversight on my part, I didn't think about performance, this does cause the compute table to be iterated twice, resulting in a waste of resources.

Thanks for the heads up, I'm glad you made a correction to my problem, I'll pay more attention to this area in the future.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more

tamerj1
Super User
Super User

@spandy34 
Please refer to attached sample file with the solution

1.png

Month Date = 
VAR MinDate =
    DATE ( 2007, 7, 1 )
VAR MaxDate =
    DATE ( 2099, 12, 31 )
VAR Months =
    DATEDIFF ( MinDate, MaxDate, MONTH )
VAR T =
    GENERATESERIES ( 0, Months, 1 )
RETURN
    SELECTCOLUMNS (
        T,
        "StartDate", EDATE ( Mindate, [Value] ),
        "EndDate", EOMONTH ( MinDate, [Value] )
    )
Anonymous
Not applicable

Hi  @spandy34 ,

 

Here are the steps you can follow:

1. Create calculated table.

Table =
var _table1=
CALENDAR(
    DATE(2007,1,1),
    DATE(2099,12,31))
var _table2=
ADDCOLUMNS(
    _table1,"Enddate",EOMONTH([Date],0))
return
FILTER(
    _table2,   [Date]=MINX(FILTER(_table2,YEAR([Date])=YEAR(EARLIER([Date]))&&MONTH([Date])=MONTH(EARLIER([Date]))),[Date]))

2. Result:

vyangliumsft_0-1693968866367.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Hi @Anonymous 
That would definitely work. But why to create a 35k rows calendar table then iterate over it two times, first time to add a 35k rows column and 2nd time to filter it down 1k rows, while the same can be achieved in one iteration over a 1k rows series table which is 315 times faster?

2.png

parry2k
Super User
Super User

@spandy34 have you tried what I posted?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@spandy34 of simply add two columns in the date dimension using following code:

 

Start of Month = EOMONTH ( Calendar[Date], -1 ) + 1

End of Month = EOMONTH ( Calendar[Date], 0 )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

tamerj1
Super User
Super User

Hi @spandy34 

please try

Month Date =
VAR MinDate =
DATE ( 2007, 7, 1 )
VAR MaxDate =
DATE ( 2099, 12, 31 )
VAR Months =
DATEDIFF ( MinDate, MaxDate, MONTH )
VAR T1 =
GENERATESERIES ( 0, Months, 1 )
RETURN
SELECTCOLUMNS (
T,
"StartDate", EDATE ( Mindate, [Value] ),
"EndDate", EOMONTH ( MinDate, [Value] )
)

spandy34
Responsive Resident
Responsive Resident

Hi

 

I get this message

spandy34_0-1693900168592.png

 

@spandy34 

Sorry its a typo in the variable name

Month Date =
VAR MinDate =
DATE ( 2007, 7, 1 )
VAR MaxDate =
DATE ( 2099, 12, 31 )
VAR Months =
DATEDIFF ( MinDate, MaxDate, MONTH )
VAR T =
GENERATESERIES ( 0, Months, 1 )
RETURN
SELECTCOLUMNS (
T,
"StartDate", EDATE ( Mindate, [Value] ),
"EndDate", EOMONTH ( MinDate, [Value] )
)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors