Forum Discussion

cmckinney's avatar
cmckinney
Icon for Helper IV rankHelper IV
6 years ago
Solved

Change first column in matrix to show different text value using DAX.

Basically, I have a DAX expression that is in the values field of a matrix that shows whether or not a hashed values has changed from the previously displayed date to the newer date. That explaination may be confusing so I will attach a screenshot of what I mean. What it is currently showing in the first column of the matrix is "rule has changed" BUT I need the first column to say is "no change". Can anyone help me edit this DAX expression so that the first column in the matrix is showing "no change"?

 

  • cmckinney - I think I fixed this in our other thread, sorry it took me a bit to get to it, check there and let me know. The suggestion from the other thread was:

    Measure =
      VAR __Rule = MAX([Rule])
      VAR __CurrentDate = MAX([Analysis Run])
      VAR __CurrentHash = MAX([Hash])
      VAR __PreviousDate = MAXX(FILTER(ALL('Table'),[Analysis Run]<__CurrentDate),[Analysis Run])
      VAR __PreviousHash = MAXX(FILTER(ALL('Table'),[Analysis Run]=__PreviousDate && [Rule]=__Rule),[Hash])
    RETURN
      SWITCH(TRUE(),
        ISBLANK(__PreviousDate)||__PreviousDate<0||YEAR(__PreviousDate)<1900,0,
        ISBLANK(__Rule),0,
        __Rule = "UnusedRule1",0,
        __PreviousHash <> __CurrentHash,1,BLANK(),
        2
      )

1 Reply

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

    cmckinney - I think I fixed this in our other thread, sorry it took me a bit to get to it, check there and let me know. The suggestion from the other thread was:

    Measure =
      VAR __Rule = MAX([Rule])
      VAR __CurrentDate = MAX([Analysis Run])
      VAR __CurrentHash = MAX([Hash])
      VAR __PreviousDate = MAXX(FILTER(ALL('Table'),[Analysis Run]<__CurrentDate),[Analysis Run])
      VAR __PreviousHash = MAXX(FILTER(ALL('Table'),[Analysis Run]=__PreviousDate && [Rule]=__Rule),[Hash])
    RETURN
      SWITCH(TRUE(),
        ISBLANK(__PreviousDate)||__PreviousDate<0||YEAR(__PreviousDate)<1900,0,
        ISBLANK(__Rule),0,
        __Rule = "UnusedRule1",0,
        __PreviousHash <> __CurrentHash,1,BLANK(),
        2
      )