Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Calculate the difference between multiple columns in matrix

Hello! I'm scratching my brain out of this calculation.. Can anyone maybe help me on the way if it's even possible? :) I'm trying to calculate difference between multiple columns in a Matrix. ...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Anonymous ,

    Create the following column in your table.

    NEWDATE = DATE(LEFT(Table1[Date],4),RIGHT(Table1[Date],2),1)


    Then create a new table using DAX below.

    Table = SUMMARIZE(Table1,Table1[Cities],Table1[Date],Table1[NEWDATE],"countvalue",COUNT(Table1[Call ID]))

    Create the diff column in  the new table as below.

    diff = var pre= CALCULATE(FIRSTNONBLANK('Table'[countvalue],1),FILTER('Table','Table'[NEWDATE]>EARLIER('Table'[NEWDATE])&&'Table'[Cities]=EARLIER('Table'[Cities]))) return IF(ISBLANK(pre),BLANK(),pre-'Table'[countvalue])



    Regards,
    Lydia