Forum Discussion

jitpbi's avatar
jitpbi
Icon for Post Patron rankPost Patron
5 years ago

if with multiple conditions

Hi,

 

the below is the sample of my data, where table name is "Table":

 

Device NameStatusDateTime
AHealthy10/15/2020 16:05:10 PM
BHealthy10/15/2020 14:05:10 PM
AFaulty10/15/2020 16:30:20 PM
AHealthy10/15/2020 16:20:18 PM
BFaulty10/15/2020 15:05:10 PM
CHealthy10/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's avatar
    HotChilli
    Icon for Community Champion rankCommunity 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.

    • jitpbi's avatar
      jitpbi
      Icon for Post Patron rankPost Patron

      Hi HotChilli ,

       

      Actually i needed it to show in the pointer ilke: "Device ABC is faulty currently"

      so the device name should come dynamically and rest text can be static.

       

      Thanks