Forum Discussion

CJANE's avatar
CJANE
Helper I
9 years ago

Differerence for two rows in a matrix visual from the same table

I have a scenario where I need to add a new row in a matrix to display the difference between a value in 2016 versus 2017.  The 2016 and 2017 value is sourced from the same table/column.  Any recommendations?

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi CJANE,

    Could you please post raw data of your table? I make a test using original table as shown in the following screenshot.


    You can firstly add an index column into your current table, then create a new column using the DAX below, then create Matrix visuals.

    Column = IF(Table[Cate]=LOOKUPVALUE(Table[Cate],Table[Index],Table[Index]-1),Table[Sales]-LOOKUPVALUE(Table[Sales],Table[Index],Table[Index]-1),0)

     

    Thanks,
    Lydia Zhang