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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Mobile or dynamic quarters

HI,

I need to create a quarter column that changes over month. It needs to group the months by three as mobile quarters. When a new month appears in the data, this one will be the last month of the last quarter. Here are some examples:

 

pisanoagus_0-1611666129953.png

In the above image, the last month is January 2021, so the quarter its named the same and groups the last three months of the data. What happens when february comes to the data model?: 

 
 

222.png

 

How can I create a calculated column to achieve this?

Thanks!

 
 
 
1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous  ,

Here are the steps you can follow:

1. Enter power query through transform data and select add column --- index column --- from 1 to generate the index

v-yangliu-msft_0-1611795966282.jpeg

2. Create calculated column.

Quarter =
var _mod=MOD([Index],3)
return
SWITCH(
    TRUE(),
    _mod=1,CALCULATE(MAX([Month]),FILTER('Table',[Index]=EARLIER([Index])+2)),
    _mod=2,CALCULATE(MAX([Month]),FILTER('Table',[Index]=EARLIER([Index])+1)),
    _mod=0,[Month])

2. Result.

v-yangliu-msft_1-1611795966286.png

 

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous  ,

Here are the steps you can follow:

1. Enter power query through transform data and select add column --- index column --- from 1 to generate the index

v-yangliu-msft_0-1611795966282.jpeg

2. Create calculated column.

Quarter =
var _mod=MOD([Index],3)
return
SWITCH(
    TRUE(),
    _mod=1,CALCULATE(MAX([Month]),FILTER('Table',[Index]=EARLIER([Index])+2)),
    _mod=2,CALCULATE(MAX([Month]),FILTER('Table',[Index]=EARLIER([Index])+1)),
    _mod=0,[Month])

2. Result.

v-yangliu-msft_1-1611795966286.png

 

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , seems like you have FY that ends in Jan/Apr/Jul/Oct.

 

Refer to my blog where you can have qtr start date for any on the 12 month start.

1.Creating Financial Calendar - From Any Month
https://community.powerbi.com/t5/Community-Blog/Creating-Financial-Calendar-Decoding-Date-and-Calendar-1-5-Power/ba-p/1187441

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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