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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
JemmaD
Resolver II
Resolver II

Date dimension table with rolling 13 months

I'm trying to create a date table which only goes back as far as the last 13 calendar months from today and my code does not work, can you show me where i'm going wrong?

 

Date = CALENDAR(DATE(MONTH(TODAY()-13),1,1),TODAY())

1 ACCEPTED SOLUTION
JemmaD
Resolver II
Resolver II

I found a simpler solution which corrected my original syntax
Date = CALENDAR(DATE(YEAR(TODAY()),MONTH(TODAY())-13,DAY(TODAY())),today())

View solution in original post

6 REPLIES 6
PaulDBrown
Community Champion
Community Champion

Try:

13 months Cal =
VAR _Today =
    TODAY ()
VAR __13Months =
    DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 13, DAY ( TODAY () ) )
RETURN
    CALENDAR ( __13Months, _Today )

13months.jpg

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






JemmaD
Resolver II
Resolver II

I found a simpler solution which corrected my original syntax
Date = CALENDAR(DATE(YEAR(TODAY()),MONTH(TODAY())-13,DAY(TODAY())),today())

Interesting solution. I didn't know that using Date() would automatically change the year based on the subtraction of the months 🙂

JorgePinho
Solution Sage
Solution Sage

Try this: Date = CALENDAR(DATEADD(TODAY(),-13,MONTH),TODAY())

@JorgePinho it says DATEADD must specify a column

Create a Last Refresh column for your report and use that column.

For reference: https://blogs.perficient.com/2022/08/24/how-to-show-last-refresh-date-in-power-bi/

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.