Forum Discussion

Nev433's avatar
Nev433
Frequent Visitor
9 years ago

Moving Average Over Group With Slicer

The table below shows the number of incidents raised by category.  They are grouped by month/year with each month given a rank with 1 being most recent.

 

I have a bar chart that has calls raised and closed for each month with a line for calls outstanding at end of month and an MAA.  The report is filtered to only show the top 12 ranked months with the hidden columns only used to calculate MAAs.

 

I'm trying to calculate an MAA for Calls Outstanding, but the report has a slicer so you can filter down to a specific category and I need the MAA to recalculate when a category is selected. 

 

If I use the formula below it appears to calculate MAA correctly for all incidents but when a category is selected from the slicer, the MAA line still shows values for all incidents, not just the selected category.

 

I've tried replacing 'ALL' with 'ALLSELECTED' but as months ranked 13-23 aren't displayed in graph the MAA is incorrect.

 

Calls Outstanding MAA =
CALCULATE (
Sum('Incident History'[CallsOutstanding]),
FILTER (
ALL ( 'Incident History' ),
'Incident History'[MonthRank] <= MIN ('Incident History'[MonthRank]) + 11
&& 'Incident History'[MonthRank] >= MIN ( 'Incident History'[MonthRank] )
)
)/12

 

CallYearCallMonthCallMonthStartDateCallYearMonthMonthRankCategoryCallsRaisedCallsClosedCallsOutstanding
2017301/03/2017 00:00:0017-033RMS000
2017301/03/2017 00:00:0017-033Website11118
2017301/03/2017 00:00:0017-033Website Change Request000
2017401/04/2017 00:00:0017-042Applications929218
2017401/04/2017 00:00:0017-042Hardware21245
2017401/04/2017 00:00:0017-042Miscellaneous55548
2017401/04/2017 00:00:0017-042New Software Request000
2017401/04/2017 00:00:0017-042Other Change Request000
2017401/04/2017 00:00:0017-042RMDB012
2017401/04/2017 00:00:0017-042RMS000
2017401/04/2017 00:00:0017-042Website356
2017401/04/2017 00:00:0017-042Website Change Request000
2017501/05/2017 00:00:0017-051Applications11812313
2017501/05/2017 00:00:0017-051Hardware57557
2017501/05/2017 00:00:0017-051Miscellaneous35376
2017501/05/2017 00:00:0017-051New Software Request000
2017501/05/2017 00:00:0017-051Other Change Request000
2017501/05/2017 00:00:0017-051RMDB020
2017501/05/2017 00:00:0017-051RMS000
2017501/05/2017 00:00:0017-051Website13163
2017501/05/2017 00:00:0017-051Website Change Request000

 

How can I get the MAA to work correctly when a catgeory is selected in the Slicer

 

Any help is greatly appreciated.

 

Thanks

 

Craig

3 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Nev433

     

    Hi Craig,

     

    According to my test, Allselect() or Allexcept() should work. If the minimum of the selected category is 1, monthrank 13-23 won't display. Hope this would help.

     

    4Calls Outstanding MAA =
    CALCULATE (
        SUM ( 'Incident History'[CallsOutstanding] ),
        FILTER (
            ALLEXCEPT ( 'Incident History', 'Incident History'[Category] ),
            'Incident History'[MonthRank]
                <= MIN ( 'Incident History'[MonthRank] ) + 11
                && 'Incident History'[MonthRank] >= MIN ( 'Incident History'[MonthRank] )
        )
    )

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Best Regards!

    Dale

     

    • Nev433's avatar
      Nev433
      Frequent Visitor

      Hi Dale,

       

      first apologies for the late reply, and thanks for taking time to reply.

       

      Using the ALLEXCEPT option seems to base the MAA on all other categories - in the updated chart, you can see the MAA has a much higher value than you'd expect, much higher than the Calls Outstanding at the end of each month.

       

       

      Thanks

       

      Craig

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Nev433,

     

    Could you please mark the proper answer if it's convenient for you? That will be a help to others.

     

    Best Regards!
    Dale