Forum Discussion
MathieuF
5 years agoHelper III
Calculation between 2 dates based on the same value
Hello, I am having difficulty implementing a calculation in Power BI. I'm looking to calculate the time (Created_at) between the start of the action (Name: task.taken or task.resume) and the end of...
AlB
5 years agoCommunity Champion
1. Place user_id on a table visual
2. Place this measure in the table. It will give you the time in minutes. Change if you want it in another unit
Measure =
SUMX (
DISTINCT ( Table1[task_id] ),
VAR mint_ =
CALCULATE (
MIN ( Table1[Created_at] ),
Table1[Name] IN { "task.taken", "task.resume" }
)
VAR maxt_ =
CALCULATE (
MAX ( Table1[Created_at] ),
Table1[Name]
IN { "task.completed", "task.transferred", "task.expired_from_workbin" }
)
RETURN
( maxt_ - mint_ ) * 24 * 60
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers