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
I have some attached data:
Start and End time for a survey. (Date/Time formatted)
Can someone help me write the DAX formula for total, avergage, Min and Max time to complete?
Let me know if you have any questions.
Solved! Go to Solution.
Hi @Anonymous
With your data in the form it is, You can use iterators to do these calculations: SUMX, AVERAGEX, MINX, and MAXX.
With the below measures, I formatted them as HH:mm:ss
Total Time to Complete = SUMX ( Survey, Survey[End Time] - Survey[Start time] )
Average Time to Complete =
VAR Result =
AVERAGEX ( Survey, Survey[End Time] - Survey[Start time] )
RETURN
IF ( NOT ISBLANK ( Result ), Result + TIME ( 0, 0, 0 ) )
// When datetime values are averaged, the result must be cast as datetime by adding a zero time valueMin Time to Complete = MINX ( Survey, Survey[End Time] - Survey[Start time] )
Max Time to Complete = MAXX( Survey, Survey[End Time] - Survey[Start time] )
You could also add a column to your table to pre-compute End Time - Start time, rather than calculating the duration of each row within the measure.
Regards,
Owen
Hi @Anonymous
With your data in the form it is, You can use iterators to do these calculations: SUMX, AVERAGEX, MINX, and MAXX.
With the below measures, I formatted them as HH:mm:ss
Total Time to Complete = SUMX ( Survey, Survey[End Time] - Survey[Start time] )
Average Time to Complete =
VAR Result =
AVERAGEX ( Survey, Survey[End Time] - Survey[Start time] )
RETURN
IF ( NOT ISBLANK ( Result ), Result + TIME ( 0, 0, 0 ) )
// When datetime values are averaged, the result must be cast as datetime by adding a zero time valueMin Time to Complete = MINX ( Survey, Survey[End Time] - Survey[Start time] )
Max Time to Complete = MAXX( Survey, Survey[End Time] - Survey[Start time] )
You could also add a column to your table to pre-compute End Time - Start time, rather than calculating the duration of each row within the measure.
Regards,
Owen
Thank you so much! Very helpful (especially the Average time)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 42 | |
| 23 | |
| 18 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |