Forum Discussion

bkxn226's avatar
bkxn226
Helper I
5 years ago

Retrieve the difference between successive values in time intelligence

I have data that comes into time intelligence like this:

 

 

 

I'm wondering if there is a quick way to take the difference between successive values.  For instance q2 would be 7.5% - 7.0%.  q1 would be 7.0% - 6.6% etc.   And then when i swtich it to monthly it does the same dynamically.

3 Replies

  • You can try following formule

     

    Sales Amount Prev Period Diff =
    var IsSelectedQuarter = SELECTEDVALUE('Calendar'[QuarterOfYear])
    var IsSelectedMonth = SELECTEDVALUE('Calendar'[MonthName])
    var SalesAmountAll = CALCULATE([Sales Amount],REMOVEFILTERS('Calendar'))
    Var QuarterPrev = DIVIDE(CALCULATE([Sales Amount],DATEADD('Calendar'[DateKey],-1,QUARTER)),SalesAmountAll)
    Var MonthPrev = DIVIDE(CALCULATE([Sales Amount],DATEADD('Calendar'[DateKey],-1,MONTH)),SalesAmountAll)
    RETURN
    [Sales Amount PCT] - IF(ISBLANK(IsSelectedMonth),QuarterPrev,MonthPrev)
     
    Thanks,
    Sayali
  • richbenmintz's avatar
    richbenmintz
    Resident Rockstar

    Hi bkxn226,

     

    Are you able to provide a sample .pbix file, I think the members of this forum would be better able to provide a solution if we could see the measures that will have to be evaluated and how they are constructed.

     

    Thanks,

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi bkxn226 

    What is your initial time hierarchy like ? What is the final display effect ? Could you provide a sample so that we can deal with the issue conveniently ?

     

    Best Regards

    Community Support Team _ Ailsa Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.