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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
Anonymous
Not applicable

12 Month Rolling Calculation

Background forum on how I got my initial measure https://community.powerbi.com/t5/Desktop/Having-Clause-or-something-close/m-p/944351#M452558

So I'm trying to get a 12 month rolling calculation for my measure by Year/Mo. I expected to get 88 at legal entity = '4' and year/mo = '2019/12'. Instead I'm getting only 1. I checked my SQL tables and in December there was only 1 record. I can't figure out how to get my DAX to ignore the year/mo filter applied by visual.

Pure_CEMI_Customers = 
var _12MoStartDate = DATE(YEAR(MAX('Date Table'[Date])), MONTH(MAX('Date Table'[Date])) -11, 1)
var _12MoEndDate = DATE(YEAR(MAX('Date Table'[Date])), MONTH(MAX('Date Table'[Date])), DAY(MAX('Date Table'[Date])))
var _count = CALCULATE(COUNT(Outages[CASE_ID]))
var Pure_CEMI_Customers =
  COUNTROWS(
        FILTER(
            VALUES(Outages[Account_NBR]), -- gets a distinct list of account_nbr
                                -- forces a context transition so that Case_ID is
                                        -- filtered for just those under the current Account_nbr        
                CALCULATE(
                    COUNT(Outages[CASE_ID]), ALLSELECTED('Date Table'), DATESBETWEEN('Date Table'[Date], _12MoStartDate, _12MoEndDate)
                ) 
             > SELECTEDVALUE(CEMI_Threshold[CEMIn], 9)
        )
    )
return Pure_CEMI_Customers

 Untitled.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I figured out a solution. Instead of duing my 12mo rolling in the same measure, I created a new measure and did it there. Don't know why but it fixed the issue.

12Month Rolling =
var enddate = MAX('Date Table'[Date])
var startdate = EDate(enddate, -11)
return calculate(
                  [pure_cemi],
                  all('Date Table'),
                  datesbetween('Date Table'[Date], startdate, enddate)
                 )

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

To ignore filters use REMOVEFILTERS or something like ALL or ALLEXCEPT. There is a rolling quick measure calculation. Also, See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

I figured out a solution. Instead of duing my 12mo rolling in the same measure, I created a new measure and did it there. Don't know why but it fixed the issue.

12Month Rolling =
var enddate = MAX('Date Table'[Date])
var startdate = EDate(enddate, -11)
return calculate(
                  [pure_cemi],
                  all('Date Table'),
                  datesbetween('Date Table'[Date], startdate, enddate)
                 )

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.