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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to display last 5 quarters based on current date

Hi Experts,

 

We have data that shows the pupulation increase for all the cities for all quarters.

 

In my report i have a slicer 'City'  and a line graph. The requirement is when we select a particular city from the slicer, then data only for last 5 quarters should be displayed in the Line graph.

 

Last 5 quarters from Current date.

Please advise how can we achieve this.

 

Many thanks.

 

1 ACCEPTED SOLUTION
v-danhe-msft
Employee
Employee

Hi @Anonymous,

Based on my test, you could refer to below formula to calculate the last quarter:

Sample data:

1.PNG

Create below calculated column:

Last quarter = IF(YEAR('Table'[Date])<MAXX('Table',YEAR('Table'[Date])),(MAXX('Table',YEAR('Table'[Date]))-YEAR([Date]))*4+5-[Quarter],[Quarter])

1.PNG

You could use this new column to create a slicer to show the last 5quarter:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
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

5 REPLIES 5
chane
New Member

Hello, I found this solution is useful to show the last quarters. However, is there any method to update the last quarter compared to the current date? Thanks a lot! 

v-danhe-msft
Employee
Employee

Hi @Anonymous,

Based on my test, you could refer to below formula to calculate the last quarter:

Sample data:

1.PNG

Create below calculated column:

Last quarter = IF(YEAR('Table'[Date])<MAXX('Table',YEAR('Table'[Date])),(MAXX('Table',YEAR('Table'[Date]))-YEAR([Date]))*4+5-[Quarter],[Quarter])

1.PNG

You could use this new column to create a slicer to show the last 5quarter:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Daniel, your solution is very useful! is there any method to update the last quarter compared to the current date? Thanks a lot! 

Anonymous
Not applicable

Thanks @v-danhe-msft .

 

Your solution helped me. Thanks again.

 

Greg_Deckler
Super User
Super User

See if my Quick Measure Time Intelligence The Hard Way will work for you: https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT... If you can post sample data and expected result then can be more specific.

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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