Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi everyone.
I would like to create a Calendar table that contains all the dates of the previous 12 months + dates until today.
For example, if today is 3rd December 2021, the table would contain dates from 01/12/2020 to 03/12/2021.
Of course, if today is, for example, 05/01/2021, the table would contain dates from 01/12/2019 to 05/01/2021, so I need to turn back 2 years.
This is the formula I wrote:
Solved! Go to Solution.
Hi @mtrevisiol ,
Your question is not much clear to me but the code which you are trying needs to be written as mentioned below:
MyCalendar =
VAR decreased_month =
MONTH ( TODAY () ) - 1
VAR start_date =
IF (
decreased_month > 0,
DATE ( YEAR ( TODAY () ) - 1, decreased_month, 1 ),
DATE ( YEAR ( TODAY () ) - 2, decreased_month + 12, 1 )
)
RETURN
CALENDAR ( start_date, TODAY () )Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi @mtrevisiol ,
Your question is not much clear to me but the code which you are trying needs to be written as mentioned below:
MyCalendar =
VAR decreased_month =
MONTH ( TODAY () ) - 1
VAR start_date =
IF (
decreased_month > 0,
DATE ( YEAR ( TODAY () ) - 1, decreased_month, 1 ),
DATE ( YEAR ( TODAY () ) - 2, decreased_month + 12, 1 )
)
RETURN
CALENDAR ( start_date, TODAY () )Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 102 | |
| 79 | |
| 57 | |
| 51 | |
| 46 |