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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Telstar
Helper I
Helper I

Rolling 12 month value retaining all user slicer selections

Hi

Hoping someone can assist in my struggle

I have 
Main table - facts and $ amounts(15 cols in total) - one date field: first of month

dimDate - calendar table - joined to main table on date>first of month

Currency table - joined to main table on currency column

Account table - hierarchy of accounts - joined to main table on account column

Business units table - hierarchy of BU - joined to main to on BU column

Amount type - list of amount type - budget, actual, prior year, working - joined to main on type columns; one or more types be selected.

 

UI shows slicers for currency,account,BU,Type and Month&year(from dimDate table) - user will select whatever combo they need.

Requirement is to show a rolling 12 month balance for the selections made in a clustered bar chart

 

The rolling 12 months are from the user select month&year backwards, summing the previous 12 months each time e.g

User selects Apr 2020 - graph will dispaly Apr 2020 - May2019 (right to left)

Apr 2020 = Sum(apr2020:May2019)
Mar2020 = Sum(mar2020:Apr2019)

May2019 = Sum(may2019:Apr2018)
The display is also the 12 months back from the user selection.

 

The issue I am having is that my measures(s) are aggregating the amount if two or more 'Amount Type' are selected

R12 measure

     R12_MTD =
          CALCULATE (
          SUM ( Main[Amount] ),
          ALL(dimDate),

          filter(ALLSELECTED(Main),Main[YearMonthNo]<=Max(Main[YearMonthNo]))
           )

 R12 display measure

      R12 (last 12 months) =
           CALCULATE (
           [R12_MTD],
           DATESINPERIOD ( 'dimDate'[Date], MAX ( 'dimDate'[Date] ), -12 MONTH ))

 

When the user makes a single selection for amount type e.g. Actual the bar chart displays as expected, all user selections applied.

 

If the user selects say 'Actual' and 'Budget' - two bars display (bud and act) but the values are identical and are the aggregation of budget + actual

So instead of showing Actual =50 and budget= 100 UI display is two identical bars of 150!!

 

Hope this is clear

Any help greatly apprecaited

 

Cheers

Telstar

2 REPLIES 2
amitchandak
Super User
Super User

@Telstar , You can try like this using date calendar

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-12,MONTH))
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(Sales[Sales Date]),-12,MONTH))  
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],startofmonth(Sales[Sales Date]),-12,MONTH))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

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

thanks for the response @amitchandak 

I have used a calendar table and it is marked as a such and links to my my main table on date.

 

Using any of your suggested DAX (in my scenario) doesnt give the desired ouput of a rolling total

I get the separated bars with amounts that are not identical but it is not actually performing the sum for 12 months I just get the monthly balance

 

Cheers

Terry

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors