Forum Discussion

StephenK2022's avatar
StephenK2022
Frequent Visitor
4 years ago
Solved

Maximum Time in mins based on date range from slicer

Hi all,   First time using this forum so I hope I'm posting in the right place.   I am trying to work out how to dynamically change the amount of minutes in a day based on the date range chosen i...
  • tamerj1's avatar
    tamerj1
    4 years ago

    StephenK2022 
    Yes becuase DATEDIFF return 0 for the same date difference. Please try

    Logged mins vs total mins (Total Accounted for Mins minus Average of TOTAL MINUTES) =
    VAR FirstDateInFilter =
        MINX (
            ALLSELECTED ( '24hr production report'[Dates] ),
            '24hr production report'[Dates]
        )
    VAR LastDateInFilter =
        MAXX (
            ALLSELECTED ( '24hr production report'[Dates] ),
            '24hr production report'[Dates]
        )
    VAR TotalMinutes =
        DATEDIFF ( FirstDateInFilter, LastDateInFilter + 1, MINUTE )
    VAR AccountedMinutes =
        SUM ( '24hr production report'[Total Accounted for Mins] )
    RETURN
        ABS ( TotalMinutes - AccountedMinutes )