Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I’m trying to replicate an Excel Report to a Power BI Report that is a time duration. Right now I am not getting the total time duration that I need.
Here are two columns from the Excel Report.
Here are two columns from the Power BI Report.
The left-hand column is correct because it is a new category that is only a day old. The right-hand column is incorrect because it is not showing the total duration. For example, the entry that says ’14:18:24’ should say ‘134:18:24’. I am using military-time with my calculations.
Does anyone know how I can get Total Time Duration on Power BI?
Thanks
Dan
Solved! Go to Solution.
It is leaving out the hours of the full days, the difference between 134:18:24 and 14:18:24 is 120:00:00 which is 5 days.
If you have the duration in seconds you can convert it to show the whole amount with a measure like this.
Full Duration =
VAR _Seconds = [Duration Seconds]
VAR _Minutes = INT ( DIVIDE ( _Seconds, 60 ) )
VAR _RemainingSeconds = MOD ( _Seconds, 60 )
VAR _Hours = INT ( DIVIDE ( _Minutes, 60 ) )
VAR _RemainingMinutes = MOD ( _Minutes, 60 )
RETURN
IF (
NOT ISBLANK ( [Duration Seconds] ),
FORMAT ( _Hours, "00" ) & ":" &
FORMAT ( _RemainingMinutes, "00" ) & ":" &
FORMAT ( _RemainingSeconds, "00" )
)
That will return a duration that looks like this:
Your solution worked even though I needed to convert to seconds before I could use the measure that you showed me above...thanks!!!!
It is leaving out the hours of the full days, the difference between 134:18:24 and 14:18:24 is 120:00:00 which is 5 days.
If you have the duration in seconds you can convert it to show the whole amount with a measure like this.
Full Duration =
VAR _Seconds = [Duration Seconds]
VAR _Minutes = INT ( DIVIDE ( _Seconds, 60 ) )
VAR _RemainingSeconds = MOD ( _Seconds, 60 )
VAR _Hours = INT ( DIVIDE ( _Minutes, 60 ) )
VAR _RemainingMinutes = MOD ( _Minutes, 60 )
RETURN
IF (
NOT ISBLANK ( [Duration Seconds] ),
FORMAT ( _Hours, "00" ) & ":" &
FORMAT ( _RemainingMinutes, "00" ) & ":" &
FORMAT ( _RemainingSeconds, "00" )
)
That will return a duration that looks like this:
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 45 | |
| 44 | |
| 20 | |
| 19 |
| User | Count |
|---|---|
| 73 | |
| 71 | |
| 34 | |
| 33 | |
| 31 |