Forum Discussion
jshankle89
8 years agoNew Member
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. ...
- Anonymous8 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
Anonymous
8 years agoNot applicable
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
jshankle89
8 years agoNew Member
I'm going to do some deeper testing, but this seems to do exactly what I needed. Thanks so much! I will look into the documentation to learn the difference between the Min and MinX functions, in addition to the use of the All function. This was one of the first Power BI reports I have created, so its been a great learning experience.