Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Create Card with Value by Date

hello, i have this powerbi dahsboard and all the details below:         I have 2 tables:   attendance table:   Id Name Date Clock in Clock Out Absent 1 Lebron ...
  • tamerj1's avatar
    4 years ago

    Hi Anonymous 
    Actually the solution I provided in your previous post shall work fine with no issues. The reason is when the employee is absent then his time is already zero and no need to make any further filtering.

    https://www.dropbox.com/t/l7mnejNnTkgNaqr3

    Monthly Salary Measure = 
    SUMX (
        employee,
        VAR CurrentRate = employee[Payment per hour]
        VAR CurrentMonth = MONTH (  employee[Date] )
        VAR CurrentYear = YEAR ( employee[Date] )
        RETURN
            SUMX (
                FILTER ( 
                    RELATEDTABLE ( attendance ), 
                    MONTH ( attendance[Date] ) = CurrentMonth
                        && YEAR ( attendance[Date] ) = CurrentYear
                        && attendance[Absent] = "Present"
                ),
                VAR Clockin = attendance[Clock in]
                VAR Clockout = attendance[Clock Out]
                VAR NumberOfHours = DATEDIFF ( Clockin, Clockout, HOUR )
                RETURN
                    CurrentRate * NumberOfHours
            )
    )