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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
vaidehi31
Frequent Visitor

Last N Fiscal Quarters Slicer/Filter

Hello,

 

I need to create a slicer where I need Last 4 quarters, Last 8 quarters and Last 12 quarters as the items. I have a calendar table and also have the fiscal quarters. The problem I'm facing is the quarters are repeatitive hence unable to either create groups or a column. For example, 2020 Q4 will be present in Last 4 quarters, Last 8 quarters as well as Last 12 quarters item.

 

Any help is highly appreciated.

 

Thanks!

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @vaidehi31

 

You can create a new table as:

v-xulin-mstf_0-1618451545801.png

And then use switch to filter different time periods.

Create a measure like:

= SWITCH([slicer table], Last 4 quarter, DATESBETWEEN(Last 4 quarter), 
                         Last 8 quarter, DATESBETWEEN(Last 8 quarter),
                         Last 12 quarter, DATESBETWEEN(Last 12 quarter),
        )  

 

You can refer: https://docs.microsoft.com/en-us/dax/switch-function-dax

 

Best Regards,

Link

View solution in original post

3 REPLIES 3
v-xulin-mstf
Community Support
Community Support

Hi @vaidehi31

 

You can create a new table as:

v-xulin-mstf_0-1618451545801.png

And then use switch to filter different time periods.

Create a measure like:

= SWITCH([slicer table], Last 4 quarter, DATESBETWEEN(Last 4 quarter), 
                         Last 8 quarter, DATESBETWEEN(Last 8 quarter),
                         Last 12 quarter, DATESBETWEEN(Last 12 quarter),
        )  

 

You can refer: https://docs.microsoft.com/en-us/dax/switch-function-dax

 

Best Regards,

Link

amitchandak
Super User
Super User

@vaidehi31 , In case you need rolling data you can try like

 

Rolling 4 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,QUARTER))

 

 

WIth help from Qtr rank column in date table

Columns

Qtr Year = year([Date]) & [Qtr]
Qtr Rank = RANKX(all('Date'),'Date'[Qtr Year ],,ASC,Dense)

 

Last 4 Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]>=max('Date'[Qtr Rank])-4 && 'Date'[Qtr Rank]<=max('Date'[Qtr Rank]) ))

 

Or refer my video, if you want to select a date then want to have 4 qtrs display on trend

https://www.youtube.com/watch?v=44fGGmg9fHI

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi Amit, thank you for your response.

 

However, I do not want to calculate sum of sales or anything, just want it in the slicers so that whenever that option is chosen, everything else on the report page filters accordingly. For example, if I choose Last 4 quarters option, all my charts should reflect data only for the last 4 quarters ie. 2020Q4, 2020Q3, 2020Q2, 2020Q1.

 

Thanks!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.