Forum Discussion
jitpbi
Post Patron
5 years agoif with multiple conditions
Hi,
the below is the sample of my data, where table name is "Table":
| Device Name | Status | DateTime |
| A | Healthy | 10/15/2020 16:05:10 PM |
| B | Healthy | 10/15/2020 14:05:10 PM |
| A | Faulty | 10/15/2020 16:30:20 PM |
| A | Healthy | 10/15/2020 16:20:18 PM |
| B | Faulty | 10/15/2020 15:05:10 PM |
| C | Healthy | 10/15/2020 16:20:18 PM |
Now, I want to drive the measure which can let me know which devices are in faulty status currently or no device in faulty status.
I need something like this:
Faulty_Devices = If(Table[status] = "Faulty" && Table[DateTime] = max(Table[DateTime]), "Currently Device ++ (Device Name)++ in Faulty stage", "No Device is in Faulty stage right now")
Please help to achieve this.
Thanks
2 Replies
- HotChilli
Community Champion
Create a measure:
MeasureD = VAR maxDate = MAX(TableQ[DateTime]) VAR badTab = FILTER(TableQ, TableQ[Status] = "Faulty" && TableQ[DateTime] = maxDate) RETURN IF (COUNTROWS(badTab) > 0, "faulty", "Not")Put it on a table with Device
For best performance, you should use a separate date and time table but this might work as it is.