Forum Discussion

hgzelaya's avatar
hgzelaya
Icon for Helper I rankHelper I
7 years ago
Solved

Help!! Previous month status vs next month

Hello everyone,   i´m having an issue with the following excercise.   Client ID Status Month CONDITION 250 UNAVAILABLE abr.-19 FALSE 250 UNAVAILABLE may.-19 FALSE 250 OK jun...
  • jdbuchanan71's avatar
    7 years ago

    Hello hgzelaya 

    If the Month column is an actual date I was able to get it to work with this.

    Condition = 
    VAR ClientID = 'YourTable'[Client ID]
    VAR PMStatus =
        CALCULATE (
            MAX ( 'YourTable'[Status] ),
            ALL ( 'YourTable' ),
            'YourTable'[Client ID] = ClientID,
            DATEADD ( 'YourTable'[Month], -1, MONTH )
        )
    VAR CMStatus = 'YourTable'[Status]
    RETURN
        NOT ISBLANK ( PMStatus )
        && NOT CONTAINSSTRING ( PMStatus, "OK" )
        && CONTAINSSTRING ( CMStatus, "OK" )