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
Hi,
I have data of telephone calls with details of each call.
Now I need to calculate the duration of each call if the reason is completed.
So for the call with call_id 123 the duration is 4 minutes.
I have no idea where to start ...
I really would like to learn how to do this.
Solved! Go to Solution.
@Dicko
Add the following code as a new column to your table:
Difference =
VAR __ID = Table2[call_id]
VAR __TIME = Table2[timestamp]
RETURN
IF(
Table2[reason] = "completed",
DATEDIFF(
CALCULATE(
min(Table2[timestamp]),
Table2[call_id] = __ID,
Table2[timestamp] < __TIME,
REMOVEFILTERS(Table2)
),
__TIME,
MINUTE
)
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Dicko
Add the following code as a new column to your table:
Difference =
VAR __ID = Table2[call_id]
VAR __TIME = Table2[timestamp]
RETURN
IF(
Table2[reason] = "completed",
DATEDIFF(
CALCULATE(
min(Table2[timestamp]),
Table2[call_id] = __ID,
Table2[timestamp] < __TIME,
REMOVEFILTERS(Table2)
),
__TIME,
MINUTE
)
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Thanks! I learned something new 🙂
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!