Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

comparing deviations of multiple points in time

Hi Pbi Community,   I feel I'm stuck at a calculation I need to perform, may be it is the complexity of the data or something else but I just can't wrap my head around it.   So my data looks ...
  • Anonymous's avatar
    Anonymous
    6 years ago

    So finally after trying and tweaking a lot here and there I got the solution which works for me πŸ™‚

     

    Still huge thanks v-xuding-msft for guiding me into the right direction πŸ€˜.

     

    below formula works perfectly. Hope it helps someone someday πŸ˜€.

     

    Flag =

        var a= CALCULATE(SUM(Table[deviation]),FILTER(Table, Table[month/year].[Year]=[prev year] && Table[month/year].[Month]=EARLIER(Table[month/year].[Month]) && Table[key1]=EARLIER(Table[key1]) && Table[key2]=EARLIER(Table[key2]) ))

        var b= CALCULATE(SUM(Table[deviation]),FILTER(ALL(Table), Table[month/year].[Year]=[curr year] && Table[month/year].[Month]=EARLIER(Table[month/year].[Month]) && Table[key1]=EARLIER(Table[key1]) && Table[key2]=EARLIER(Table[key2])  ))

        var c= CALCULATE(SUM(Table[deviation]),FILTER(ALL(Table), Table[month/year].[Year]=[new year] && Table[month/year].[Month]=EARLIER(Table[month/year].[Month]) && Table[key1]=EARLIER(Table[key1]) && Table[key2]=EARLIER(Table[key2])  ))

        return IF( a>=3*b || b>=3*a || a>=3*c || c>=3*a || b>=3*c || c>=3*b, "True", "False")