Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have odometer values for various device names. I want to calculate the odometer value of the latest date minus the odometer value of the oldest date. How to calculate it with PowerBI?
Solved! Go to Solution.
Since the odometer value is increasing over time, it will be smallest at the oldest date and largest at the latest date, so you could just create a measure like this:
measure = MAX(Table[Value.data.odometer])-MIN(Table[Value.data.odometer]) and it should get you the correct calculation.
In case there is a scenario where the minimum and maximum values are not on the oldest and latest dates, you could use CALCULATE.
Something like this:
measure =
VAR earliest_value = CALCULATE(MIN(Table[Value.data.odometer]),Table[Value.data.received_at]=MIN(Table[Value.data.received_at]))
VAR latest_value= CALCULATE(MIN(Table[Value.data.odometer]),Table[Value.data.received_at]=MAX(Table[Value.data.received_at]))
RETURN
latest_value - earliest_value
Proud to be a Super User! | |
Since the odometer value is increasing over time, it will be smallest at the oldest date and largest at the latest date, so you could just create a measure like this:
measure = MAX(Table[Value.data.odometer])-MIN(Table[Value.data.odometer]) and it should get you the correct calculation.
In case there is a scenario where the minimum and maximum values are not on the oldest and latest dates, you could use CALCULATE.
Something like this:
measure =
VAR earliest_value = CALCULATE(MIN(Table[Value.data.odometer]),Table[Value.data.received_at]=MIN(Table[Value.data.received_at]))
VAR latest_value= CALCULATE(MIN(Table[Value.data.odometer]),Table[Value.data.received_at]=MAX(Table[Value.data.received_at]))
RETURN
latest_value - earliest_value
Proud to be a Super User! | |
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 37 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 89 | |
| 73 | |
| 66 | |
| 65 |