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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Year over Year rolling 12 months

Hi,

 

I want to create a visual where I compare months this year to the same months last year. This part causes no problems. However, I want to make the visual dynamic such that it shows the current month at the end of the x-axis and rolling -12 months back in time. So far I have tried two different approaches: 

 

1) Capture.PNG

This one somewhat gives me the desired outcome, but how do I get rid of the tails? I want the visual to show one bar with values representing December 2019 to November 2020 (today) and one bar showing values from December 2018 to November 2019 for monthly comparison. Additionally it has to be dynamic.

 

2)

 

Capture1.PNG

 

In this visual I only use the relevant fields with filters and no measure. This one gives me the desired outcome, but how do I sort it chronologically to give med the current month (November) at the end of the x-axis? I have tried to sort the field MonthName (x-axis) with MonthNumber in my date dimension, only to make the visual sort wither from month 12 to 1 or from 1 to 12. 

 

Any advise? Much appreciated!

 

BR

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous 
You might create 2 measures, measure 1 between today and - 365 days , and measure 2 is between - 365 days and -730 days. Something like:

 

measure 1 = Calculate(sum([value]), filter(table, [date]<=today() &&[date]>=today()-365))

measure 2 = Calculate(sum([value]), filter(table, [date]<=today()-365 &&[date]>=today()-365*2))


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Anyone else having a suggestion?

 

Thanks 🙂

Anonymous
Not applicable

@Anonymous 
You might create 2 measures, measure 1 between today and - 365 days , and measure 2 is between - 365 days and -730 days. Something like:

 

measure 1 = Calculate(sum([value]), filter(table, [date]<=today() &&[date]>=today()-365))

measure 2 = Calculate(sum([value]), filter(table, [date]<=today()-365 &&[date]>=today()-365*2))


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Not very clear , if want sorting to desc create column like these and mark them sort colum

 

Month Year = FORMAT([Date],"mmm-yyyy")
Month Year sort = FORMAT([Date],"yyyymm")
Month Year Rank = RANKX(ALL('Date'),'Date'[Month Year Sort],,DESC,Dense)

 

Sort month Year on Month Year Rank  in place of Month Year sort

 

Month = FORMAT([Date],"mmmm")
Month sort = month([Date])
Month Rank = RANKX(ALL('Date'),'Date'[Month Year Sort],,DESC,Dense)

 

Sort month on Month Rank  in place of Month sort

 

https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column

 

expected output is not very clear to me

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks for your reply, amitchandak!

 

Your suggested method provides the same output as my second approach described above i.e. it sorts from December to January or January to December. How can I make it sort from November (current month) and 12 months back (November 2019)?

 

Thanks!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.