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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
Anonymous
Not applicable

Date table via Dax till end of last month

Hello,

 

Can someone please help me to modify this date table? I am looking for this date table to end dynamically at the end of last month rather than full year.

 

 

DATE = 
VAR MINYEAR = (YEAR(TODAY())) - 4
VAR MAXYEAR = YEAR(TODAY())
--VAR MAXMONTH = if (YEAR(TODAY() = 2022 MONTH(TODAY())-1
return
ADDCOLUMNS(
    FILTER(
CALENDARAUTO(),
    YEAR ( [DATE]) >= MINYEAR &&  YEAR ( [DATE]) <= MAXYEAR
 
  
    ),
"Year", YEAR([Date]),
"Month", MONTH([Date]),
"YearMonth", FORMAT([Date],"yyyymm"),
"Month Label", FORMAT([Date],"mmm"),
"QKey", QUARTER([Date])
)

Thanks,

RK

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

  Thanks. I had to just modify your formula a little bit to make it work. Thanks for your help.

CALENDAR( DATE( YEAR(TODAY())-4,1,1), EOMONTH(TODAY(), -1)), 

RK_JOB_0-1655322819563.png

@johnt75

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

Instead of CALENDARAUTO and filtering on years you could try CALENDAR( DATE( YEAR(TODAY()-4),1,1), EOMONTH(TODAY(), -1))

Anonymous
Not applicable

  Thanks. I had to just modify your formula a little bit to make it work. Thanks for your help.

CALENDAR( DATE( YEAR(TODAY())-4,1,1), EOMONTH(TODAY(), -1)), 

RK_JOB_0-1655322819563.png

@johnt75

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.