Forum Discussion

nchr's avatar
nchr
Frequent Visitor
1 year ago
Solved

Dynamic Format not working with Durations

In my reports, I use durations in seconds for various metrics. It is handy to create visuals and make calculations, but when displaying the values, users prefer to see "hh:mm:ss" instead of the numbe...
  • OwenAuger's avatar
    1 year ago

    Hi nchr 

    (PBIX attached)

     

    Try changing the measure to:

    Dynamic Formatted = 
    CONVERT ( [Duration] / ( 24 * 60 * 60 ), DATETIME )

    and the format string expression to:

    IF ( [Dynamic Formatted] > 1 / 24, "hh:mm:ss", "mm:ss" )

    (it appears "mm" is required here).

     

    When Power BI formats a measure in a visual it will only apply datetime format codes to a datetime value.

     

    Does this work at your end?