March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Seems like a simple problem however I cannot find a solution. Can anyone assist?
Operators use a piece of equipment and then enter a series of checks for mainteance Items. Within that they enter the meter reading. To tabulate how much our entire fleet is being used and be able to slice it with any given day I need the usage field to populate with the amount of hours used based upon the last meter reading. I could set up a separate table with starts/ends of each week to get the max and min but this seems like a workaround. Matt
DateTimeStamp | Vehicle | Reading | Usage |
1/1/2017 08:00:00 | a | 1 | 0 |
1/1/2017 08:00:01 | b | 2 | 0 |
1/1/2017 08:00:02 | c | 3 | 0 |
1/1/2017 16:00:03 | a | 4 | 3 |
1/1/2017 16:00:04 | b | 5 | 3 |
1/1/2017 16:00:05 | c | 6 | 3 |
1/2/2017 08:00:06 | a | 10 | 6 |
1/2/2017 08:00:07 | b | 11 | 6 |
1/2/2017 08:00:08 | c | 12 | 6 |
1/2/2017 16:00:09 | a | 15 | 5 |
1/2/2017 16:00:10 | b | 16 | 5 |
1/2/2017 16:00:11 | c | 17 | 5 |
Solved! Go to Solution.
Sorry, none of the responses below I was able to get working. I even bought the Russo and Ferrari book to try to understand the Earlier Function.
I solved it within the source data.
=IF(ISBLANK(D2),"0",Iferror(D2-large(QUERY($C$2:D2,"Select D where C matches '"&C2&"' order by D desc limit 2"),2),0))
Line C is my vehicle ID and Line D is the hour reading the operators input each day.
A response I received on email. Couldn't get it to work.
Matt
Column = CALCULATE(MAX('T2'[Type]),FILTER(ALL('T2'),'T2'[ID]=EARLIER('T1'[ID]) &&'T2'[Date]<=RELATED(T1[Date])))
Sorry, none of the responses below I was able to get working. I even bought the Russo and Ferrari book to try to understand the Earlier Function.
I solved it within the source data.
=IF(ISBLANK(D2),"0",Iferror(D2-large(QUERY($C$2:D2,"Select D where C matches '"&C2&"' order by D desc limit 2"),2),0))
Line C is my vehicle ID and Line D is the hour reading the operators input each day.
Hi @mshodge,
According to your description above, you should be able to use the formula below to create a new measure to calculate the usage with the amount of hours used based upon the last meter reading and show it on the report with other fields.
NewMeasure = VAR lastReading = MAX ( Table1[Reading] ) RETURN CALCULATE ( SUM ( Table1[Usage] ), Table1[Reading] = lastReading )
Regards
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |