Forum Discussion

Coryanthony's avatar
Coryanthony
Helper III
3 years ago
Solved

Sum hours based on day, then create new column with IF function

Hello,  I want to sum up hours worked base on day, then create a column ($Allowed) base on the sum of hours.   $ Allow = CALCULATE(SUM(Timesheet[Number (unit)]), IF(Timesheet[Day of Week] >=0 && ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Coryanthony ,

     

    This is due to the nature of calculated columns, and you can create a table visual to show.

    You can also create a measure.

    measure_Allowed = 
    var _sum = CALCULATE(SUM('Table'[number (unit)]),FILTER(ALLEXCEPT('Table','Table'[employee id],'Table'[date]),'Table'[number (unit)]))
    return 
    IF(_sum>10&&max('Table'[Day of Week])>=0&&MAX('Table'[Day of Week])<=4,20,0)

    Please refer to my PBIX file.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly.