Forum Discussion

jshankle89's avatar
jshankle89
New Member
8 years ago
Solved

Comparing Date from Var

Hello, I'm trying to return the current battery percentage for each LeakDetector.  A device checks in multiple times per day with its battery remaining percentage and is logged in a Checkins table. ...
  • Anonymous's avatar
    Anonymous
    8 years ago

    HI jshankle89,

     

    You can try to use below formula if it works on your side.

    CurrentBatteryLevel =
    VAR lastCheckin =
        MAX ( Checkins[OccurredAt] )
    VAR detector =
        MAX ( Checkins[LeakDetectorId] )
    RETURN
        MINX (
            FILTER (
                ALL ( Checkins ),
                [LeakDetectorId] = detector
                    && [OccurredAt] = lastCheckin
            ),
            [BatteryLevel]
        )
    

    If above not help, please share some sample data for further test.

     

    Regards,

    Xiaoxin Sheng