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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
JimJim
Responsive Resident
Responsive Resident

Rolling 13 financial months

Hi Guys,

 

I have attached a pbix file with a date table included. I am trying (and failing) to calculate a column that will let me know if the date is within the previous 13 months (but not including the current month). This sounds easy, but the reason I am struggling is because I need to count financial months and usually dates from one month fall into another financial month, as an example, 25th Oct 2020 - 31st Oct 2020 fall within the financial month of November 2020.

 

On the pbix file, there is a column ExpectedResults, this is the value I am trying to calculate in the IsRolling13M column

 

Please help

 

dates.pbix 

2 ACCEPTED SOLUTIONS
Vera_33
Resident Rockstar
Resident Rockstar

@JimJim 

 

My bad, change the HelpColumn logic to this

HelpColumn = [FinancialYear]*12+[FinancialPeriod]

 

View solution in original post

JimJim
Responsive Resident
Responsive Resident

I managed to work it out, thank you to @Vera_33 for setting me on the right track.

 

It's a bit of a hack but the following code does the job

 

IsRolling13M = 
VAR _month = MONTH(TODAY())
VAR _year = YEAR(TODAY())
RETURN
SWITCH(TRUE(),
    // any month in the same financial year will be within 13 months
    'Time'[FinancialYear] = _year && 'Time'[FinancialPeriod] < _month, TRUE(),
    // any month in the previous year which is greater than or equal to the current month will also be within 13 months
    'Time'[FinancialYear] = _year-1 && 'Time'[FinancialPeriod] >= _month, TRUE(),
    // finally, if the current month is January we need to include December from 2 years previous
    'Time'[FinancialYear] = _year-2 && _month = 1 && 'Time'[FinancialYear] = 12, TRUE(),
    FALSE())

View solution in original post

5 REPLIES 5
JimJim
Responsive Resident
Responsive Resident

I managed to work it out, thank you to @Vera_33 for setting me on the right track.

 

It's a bit of a hack but the following code does the job

 

IsRolling13M = 
VAR _month = MONTH(TODAY())
VAR _year = YEAR(TODAY())
RETURN
SWITCH(TRUE(),
    // any month in the same financial year will be within 13 months
    'Time'[FinancialYear] = _year && 'Time'[FinancialPeriod] < _month, TRUE(),
    // any month in the previous year which is greater than or equal to the current month will also be within 13 months
    'Time'[FinancialYear] = _year-1 && 'Time'[FinancialPeriod] >= _month, TRUE(),
    // finally, if the current month is January we need to include December from 2 years previous
    'Time'[FinancialYear] = _year-2 && _month = 1 && 'Time'[FinancialYear] = 12, TRUE(),
    FALSE())
Vera_33
Resident Rockstar
Resident Rockstar

Hi @JimJim 

 

In your Date table, all the FinancialYear, period...columns are already there? the only one is Rolling13M? Added a helper column, file attached. Let me know if you are looking for something else.

Vera_33_0-1640046708541.png

 

JimJim
Responsive Resident
Responsive Resident

Thank you for your reply, but this doesn't work. November and December 2020 should be included in the Rolling 13 months but as you can see, your solution doesn't include any YEARS before the previous one

 

JimJim_0-1640075263676.png

 

Vera_33
Resident Rockstar
Resident Rockstar

@JimJim 

 

My bad, change the HelpColumn logic to this

HelpColumn = [FinancialYear]*12+[FinancialPeriod]

 

JimJim
Responsive Resident
Responsive Resident

Thank you so much, this is much better than my solution

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

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.