Forum Discussion

carnage66's avatar
carnage66
Frequent Visitor
4 years ago

Showing deviation compared to average or previous value

Hi guys,

Looking to create a report showing deviations. 
- deviation against the previous day
- deviation for each day against the average for the selected period
Is there any way to do that? I should note that I'm using SSAS so I'm unable to create columns to the source tables, only measures.

 

2 Replies

  • carnage66 , with help from date table

     

     

    This Day = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])))
    Last Day = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-1))
    Last Day = CALCULATE(sum('Table'[Qty]), previousday('Date'[Date]))

     

    diff =[This Day] - [Last Day]

     

    Avg of duration = calculate(Averagex(Values('Date'[Date]), [This Day]) , allselected())

     

    diff= [This Day] - [Avg of duration]

    • carnage66's avatar
      carnage66
      Frequent Visitor

      Hey amitchandak , thanks for the swift response. The functions for This/Last day work great, however the Avg of duration calculates the average for the entire matrix as shown below where as I want it to show the average for the row.