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
So I am working with Live Data. I need a POWER BI Query to create a calculated column or Measure.
What I really want is the Sum of Hours between (Start time when type = 3) and (End time when type = 3)
Basically, It starts when type = 3 and records the start time. The counter Goes on until type goes back to type = 2 and records the previous row and records the End time and then calculates the Duration between them.
The Hour Duration column is my desired Output.
Output Explanation:
I subtract the end time 23-01-2020 11:39 with the start time of previous row 21-01-2020 09:33.
Hi Greg, this is the entire table. The Hour Duration is the expected Output
@sushmitasur4 This is a variation on Previous Row. See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395....
The basic pattern is:
Column =
VAR __Current = [Value]
VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])
VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
__Current - __Previous
Tough to say, but you might also need Cthulhu. Cthulhu - Microsoft Fabric Community
Can you post your data as text and provide the expected output?
Or maybe it's simple and you can just do this:
Measure = SUMX( FILTER( 'Table', [Type] = 3 ), [End] - [Start] )
Then convert to seconds and use Chelsie Eiden's Duration? Chelsie Eiden's Duration - Microsoft Fabric Community
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 20 | |
| 11 | |
| 10 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 32 | |
| 28 | |
| 19 | |
| 11 | |
| 10 |