Forum Discussion
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.-19 | TRUE |
| 250 | OK | jul.-19 | FALSE |
| 250 | WAITING | ago.-19 | FALSE |
| 250 | OK complete | sep.-19 | TRUE |
| 260 | OK | abr.-19 | FALSE |
| 260 | OK | may.-19 | FALSE |
| 260 | OK | jun.-19 | FALSE |
| 260 | UNAVAILABLE | jul.-19 | FALSE |
| 260 | UNAVAILABLE | ago.-19 | FALSE |
| 260 | OK received | sep.-19 | TRUE |
| 270 | OK | abr.-19 | FALSE |
| 270 | OK | may.-19 | FALSE |
| 270 | PENDING | jun.-19 | FALSE |
| 270 | OK done | jul.-19 | TRUE |
| 270 | OK | ago.-19 | FALSE |
| 270 | OK | sep.-19 | FALSE |
I want a calculated column with a true/false statement in which works like this:
if previous month status is anything that doesn´t contains the word "OK" in it AND "actual month contains the word "ok"="TRUE", other than this, "FALSE".
I desire the same results shown in the table above.
This is the link for the data:
https://docs.google.com/spreadsheets/d/1L1rdcxBVGyr60FBRep0XAaeVOYNXX4a35uWNnjkK-Q4/edit?usp=sharing
Thanks for the help in advance!
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" )
2 Replies
- jdbuchanan71
Super User
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" )- hgzelaya
Helper I
i don´t actually know what you really did right there but, it actually worked! I appreciate it!