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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

Rolling 12 month calculation of previous 12 month period

Hi,

 

I have a wish from a co-worker and I just don't seem to get his wish displayed correctly.

 

I need to display our notification totals (created and of which are closed) from past 12 months in a way that it shows the sum of the last 12 month period in a single visual. 

F.E. now I need to show a time period from February 2020 - January 2021 where the number shown in February 2020 is the amount of notifications created between March 2019 - February 2020. The number in March 2020 is from April 2019 - March 2020 etc. 

 

Currently I have managed to display the monthly data without the 12 month sums.

 

I have two tables, one which serves as datetable and one which have all the information regarding our notifications. Let's call datetable as Date and colum which has the dates [Dates]. Notification table has 100 000+ rows of data shown in below table (deleted about 20 columns from the table):

Notification IDCreatedStatus
2150927024.12.2019Open
2147786813.12.2018Closed
2144600828.11.2020Open
2142846420.1.2021Closed
213877714.11.2017Open
2133645215.10.2018Closed
2133645315.10.2019Open
2128850228.1.2020Closed
212370283.1.2021Open
212370293.9.2020Closed
2115750330.1.2021Open
2112859914.12.2020Closed

 

How can I make a visual I described above? With the above figures Jan2021 should show me total of 6, Dec 2020 4, Nov 2020 4, Oct 2020 3 etc (if I did my math ok 🙂 )

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Create a measure like below and add a relative date filter (in the last 12 calendar months) to the column chart to limit the axis. Here is the PBIX file for your reference.

Measure = CALCULATE(COUNT(Notification[Notification ID]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-1,YEAR))

021804.jpgRegards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

4 REPLIES 4
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Create a measure like below and add a relative date filter (in the last 12 calendar months) to the column chart to limit the axis. Here is the PBIX file for your reference.

Measure = CALCULATE(COUNT(Notification[Notification ID]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-1,YEAR))

021804.jpgRegards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

amitchandak
Super User
Super User

@Anonymous , the expected output is not clear, have you tried relative date slicer 

https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

or this approach

https://www.youtube.com/watch?v=duMSovyosXE

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

Expected output is a column chart where I'm showing the previous 12 calendar months. Each column should have the sum of created notifications from the past 12 month period.

 

Relative date filtering isn't acceptable as it cuts the data down to the last 12 months as I actually need the data from last 24 calendar months yet I only need to show in the chart 12 prior months. 

 

In the video, he doesn't show the sales as the previous 12 month sales. He only shows each months sales and just makes slicer which he can basically choose the 12 month period he likes. I don't need it like that.

 

I need to show the last 12 calendar months in a chart and in the chart it should have 12 columns with previous 12 months. At each month it shows the amount of notifications created in the last 12 month period of that month. For example today the chart would need to show last 12 calendar months February 2020 to January 2021. February 2020 would need to show the amount of notifications created between March 2019 thru February 2020 and January 2021 would need to show the amount of notifications created between February 2020 thru January 2021 etc.

 

Hopefully I did better job at explaining what I need to create.

Anonymous
Not applicable

Hi @Anonymous 

 

Still use the chart from @v-jingzhang with YYYYMM, how about changing the measure to:

Measure = 
VAR CurMonth = SELECTEDVALUE('Date'[Month])
VAR CurYear = SELECTEDVALUE('Date'[Year])
VAR MaxDate = EDATE(DATE(CurYear,CurMonth,1),1)
VAR MinDate = EDATE(DATE(CurYear,CurMonth,1),-11)
RETURN
CALCULATE(COUNTROWS('Table'),FILTER(ALL('Date'),'Date'[Date]>=MinDate&&'Date'[Date]<MaxDate))

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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