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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
I have a column "Active" that can have two values TRUE or FALSE. I want to log time in state (days: hours: minutes) for TRUE or FALSE values in another column "TimeInState" and reset the clock when state changes. Is it possible to achive with PowerBI and if yes, what is the solution?
Thank you.
Hi @atarasov ,
Based on your description, what you want to achieve is to calculate the duration of a state. When it updates the state, it will reset the time to zero.
Unfortunately, I'm afraid it's hard to achieve according to my attempt.
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @atarasov
If you have a Time column near the State column you could create a measure
TimeInState =
var _lastPrevState = calculate(MAX(Table[Time]), FILTER(ALL(Table), Table[State] <> SELECTEDVALUE(Table[State]) && Table[Time] < SELECTEDVALUE(Table[Time]) ) )
var _firstActiveState = calculate(MIN(Table[Time]), FILTER(ALL(Table), Table[State] = SELECTEDVALUE(Table[State]) && Table[Time] > _lastPrevState ) )
RETURN
DATEDIFF(_firstActiveState , SELECTEDVALUE(Table[Time]), MINUTE)
Thank you, what is in Time column?
Thanks, I did what you have suggested, but both columns have no values in it.
What am I missing?
Thanks.
User | Count |
---|---|
98 | |
76 | |
75 | |
49 | |
27 |