Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi I am trying to find the engine hours for the following data set:
Currently I am using the following function to get the Engine_hrs :
Solved! Go to Solution.
@Anonymous , Try a new column like
Engine_hrs =
VAR PreviousRecords =
MAXX(FILTER (
MachineHours,
MachineHours[id]
< EARLIER (MachineHours[id] )
&& MachineHours[MachineName] = EARLIEST ( MachineHours[MachineName] )
),MachineHours[id])
RETURN
IF (
not(isblank ( PreviousRecords ) ),
MachineHours[EngineRunningHours] - MAXX ( FILTER(MachineHours, MachineHours[id] =PreviousRecords && MachineHours[MachineName] = EARLIEST ( MachineHours[MachineName] )),[EngineRunningHours]), blank()
)
Hi, @Anonymous
I'd like to suggest you create a calcuated column with the following dax.
Engine_hrs =
VAR PreviousID =
CALCULATE (
MAX ( MachineHours[id] ),
FILTER (
MachineHours,
MachineHours[id] < EARLIER ( MachineHours[id] )
&& MachineHours[MachineName] = EARLIER ( MachineHours[MachineName] )
)
)
VAR PreviousRecords =
FILTER (
MachineHours,
MachineHours[id] = PreviousID
&& MachineHours[MachineName] = EARLIER ( MachineHours[MachineName] )
)
RETURN
IF (
COUNTROWS ( PreviousRecords ) > 0,
MachineHours[EngineRunningHours]
- MAXX ( PreviousRecords, MachineHours[EngineRunningHours] )
)
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , Try a new column like
Engine_hrs =
VAR PreviousRecords =
MAXX(FILTER (
MachineHours,
MachineHours[id]
< EARLIER (MachineHours[id] )
&& MachineHours[MachineName] = EARLIEST ( MachineHours[MachineName] )
),MachineHours[id])
RETURN
IF (
not(isblank ( PreviousRecords ) ),
MachineHours[EngineRunningHours] - MAXX ( FILTER(MachineHours, MachineHours[id] =PreviousRecords && MachineHours[MachineName] = EARLIEST ( MachineHours[MachineName] )),[EngineRunningHours]), blank()
)
Every instance a blank record is encounterd an increment is registerd it seems. Engine_hrs_2 corresponds to formula that was provided.
@amitchandak thank you for your prompt reply. After using your formula it seems that the more engine_hrs are being accounted for. There are some inconsistencies in data where it is returning the last sum of engine hrs rather then the increment per instance. I am trying to find a weekly increment for the data. The left visual corresponds to my visual while the right table corresponds to the function you provided
@Anonymous , for Week on Week comparison you can have a measure approach using date table.
I have discussed in these blogs. see of those can help
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123
https://www.youtube.com/watch?v=pnAesWxYgJ8
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |