Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to return a previous row within a report view

Hello Community, 

I will appreciate contribution to this challenge I have been trying to figure how the return the previous row in my use cases in a Matrix view in the snipnet 2 shown below.   I created a calculated column to return previous row in the table below (Previous Cost), But when I try to reuse the column  in a Matrix view the previous row columns do not align with the cost column any longer see snipnet 2.

 

 

Thanks for your help 

Samson.

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hey Greg , 

    Thanks for the input , this is the current outcome, Things still not aligning but a big step.

     

    Thank you,

    Samson Eromonsei

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Anonymous Seems like it would be something along the lines of:

    Previous Cost (Measure) =
      VAR __CodeID = MAX('Table'[CodeID])
      VAR __Date = MAX('Table'[Date])
      VAR __Table = FILTER(ALL('Table'),'Table'[CodeID] = __CodeID && 'Table'[Date]<__Date)
      VAR __Previous = MAXX(__Table,[Date])
    RETURN
      MAXX(FILTER(__Table,[Date] = __Previous),[Cost])
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hey Greg , 

      Thanks for the input , this is the current outcome, Things still not aligning but a big step.

       

      Thank you,

      Samson Eromonsei