Forum Discussion

DAST's avatar
DAST
Frequent Visitor
3 months ago
Solved

Durations - Dynamic Formats or Calculation Groups? Or both?

I have a bunch of columns giving durations in seconds. I have a bunch of measures averaging those durations over a count of interactions, and a bunch more measures giving the sums of those durations ...
  • Shai_Karmani's avatar
    Shai_Karmani
    3 months ago

    The fix is a dynamic format string. Revert the measure to plain numeric:


    ACD handling Av =
    DIVIDE(SUM('Performance'[ACD handling time (days)]), SUM('Performance'[ACD calls handled]))

    Then select it, Measure tools ribbon, set Format to Dynamic, and paste this into the format expression:

     

    VAR Seconds = INT ( SELECTEDMEASURE () * 86400 )
    VAR Hrs = INT ( Seconds / 3600 )
    VAR Mins = INT ( MOD ( Seconds, 3600 ) / 60 )
    VAR Secs = MOD ( Seconds, 60 )
    RETURN
    """" & FORMAT ( Hrs, "00" ) & ":" & FORMAT ( Mins, "00" ) & ":" & FORMAT ( Secs, "00" ) & """"

    The `""""` wraps the time as literal text while keeping the real number underneath. Now it works everywhere: tables, charts with formatted labels, conditional formatting, and over-24h shows as 25:30:00 with no rollover.

    For your seven measures, paste it into each one, or set up one calculation group with this as the Format String Expression and SELECTEDMEASURE() as the expression. I'd do per-measure first to get it working, then tidy up with a calc group later if you want.

     

    If this helped, a thumbs up and accepting the solution would be appreciated.

     

     

     

    Best,

    Shai Karmani

     

    Let's connect in LinkedIn