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

Rolling 12 Month sum that ignores date filter

Hi, I'm wanting to create a DAX equation that ignores the date filters (But still lets people filter by other slicers) and return a sum earnings for the 12 month range.  Going back 12 Calendar Months.  I've tried the below DAX But I am not having any luck.

 

Below is the DAX I have put together. However when I use this and try to uset he date slicer in my dashboard this still filters.

 

var varEarnings = SUM(Fact[Earnings])



RETURN 


CALCULATE (
   varEarnings ,
    ALLEXCEPT ( DIMCalendar, DIMCalendar[Date] ),
    DATESINPERIOD( DIMCalendar[Date], today(), -12, MONTH )
)

 

 

Table looks something like this:
I would like it to always sum what is in yellow no matter what someone selects in the date slicer.  They can use another slicer which is Location

12MonthSum.png

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous 

Create a measure

Measure =
CALCULATE (
    SUM ( Sheet2[value] ),
    FILTER (
        ALL ( 'calendar'[Date] ),
        DATEDIFF (
            'calendar'[Date],
            TODAY (),
            MONTH
        ) >= 1
            && DATEDIFF (
                'calendar'[Date],
                TODAY (),
                MONTH
            ) <= 12
    )
)

Capture6.JPGCapture7.JPGCapture8.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
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

3 REPLIES 3
amitchandak
Super User
Super User

I do not think you need all except. I use like

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-12,MONTH))  
Rolling last 12 before 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(dateadd('Date'[Date],-12,MONTH)),-12,MONTH))  

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Anonymous
Not applicable

Thanks @amitchandak ,

This looks like it gets me halfway.  So i noticed that if I move the from date filter nothing changes.  But if I move the end date filter the #'s will reduce.  Is there a way to lock both sides of the filter down to always use today's date as it's start and go back 12 calendar months?

 

Thanks,
Jon

 

Hi @Anonymous 

Create a measure

Measure =
CALCULATE (
    SUM ( Sheet2[value] ),
    FILTER (
        ALL ( 'calendar'[Date] ),
        DATEDIFF (
            'calendar'[Date],
            TODAY (),
            MONTH
        ) >= 1
            && DATEDIFF (
                'calendar'[Date],
                TODAY (),
                MONTH
            ) <= 12
    )
)

Capture6.JPGCapture7.JPGCapture8.JPG

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

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.