Forum Discussion

James_CA's avatar
James_CA
Frequent Visitor
6 years ago
Solved

IOT Device Status (Data look up by ID)

Hi, I am new in PowerBI. I want to monitor some of my IoT Device by PowerBI Dashboard But I am unable to create the formula to DeviceID lookup on the date and create a new table   My Devices are ge...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi James_CA 

    You need to build a calculated table ,add a calculated column and use measure to achieve your goal.

    I build a table like yours to have a test.

    Table (Add a calculated column and format the Data type as Date):

    Date = 'Table'[Datetime]-TIMEVALUE('Table'[Datetime])

    AllDeviceID:

    Build a Date Table:

    Date = 
    GENERATE (
        CALENDAR ( DATE ( 2020, 09, 01 ), DATE ( 2020, 09, 04 ) ),
        AllDeviceID
    )

     Measure:

    Measure = 
    VAR _Datevalue =
        CALCULATETABLE (
            VALUES ( 'Table'[DeviceID] ),
            FILTER (  'Table' , 'Table'[Date] = MAX ( 'Date'[Date] ) )
        )
    RETURN
        IF ( MAX ( 'Date'[DeviceID] ) IN _Datevalue, "True", "False" )

    Build a matrix visual to see the result.

    You can download the pbix file from this link: IOT Device Status (Data look up by ID)

     

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.