Forum Discussion

Lucky_BI's avatar
Lucky_BI
Frequent Visitor
3 years ago
Solved

Calculate time by day

  How do I add up the duration (Time Check out - Time Check in) of each name based on the date of the day excluding him from a different outlet with DAX? Example: Name : Mike Dates: 20/03...
  • tamerj1's avatar
    3 years ago

    Hi Lucky_BI 
    DateTime format cannot display times more than 24 hours. This has to be a decimal number or custom formatted string. Please refer to attached sample file with the proposed solution

    Total Hours = 
    SUMX ( 
        SUMMARIZE ( 
            'Table',
            'Table'[Name],
            'Table'[Date]
        ),
        CONVERT ( 
            SUMX ( 
                CALCULATETABLE ( 'Table' ),
                'Table'[Time Check Out] - 'Table'[Time Check In]
            ),
            DOUBLE
        )
    )