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
RK_JOB
Helper II
Helper II

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

  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))

  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
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.