Forum Discussion

mmelerof's avatar
mmelerof
New Member
3 years ago

Extra Hours

Hi everybone,

 

Well, in my model, i have a column call "Horas Trabajas" it mean "Work Hours".

 

I want to know the extra hour my employments do, so if the work more than 160 hours per month, they are getting extra hours.

 

I do this but the summatory its wrong.

 

 

As you can see, they dont have extra hours but the summory is 4.021,72 hours.

 

This is the formula y used: 

Horas Extras = CALCULATE( IF(SUM('Enero 2023'[Horas Trabajadas])> 160 , SUM('Enero 2023'[Horas Trabajadas]) - 160 , 0))

 

 

 

2 Replies

  • mmelerof 

     

    This is the formula y used: 

    Horas Extras = CALCULATEIF(SUM('Enero 2023'[Horas Trabajadas])> 160 , SUM('Enero 2023'[Horas Trabajadas]) - 160 , 0))


    #My Solutions
    Horas Extras = calculate(SUM('Enero 2023'[Horas Trabajadas]) - calculate(SUM('Enero 2023'[Horas Trabajadas]),filter(Table,[Total Work Hours]>160)))

    mmelerof If this post helps, please consider accept as solution to help other members find it more quickly and Appreciate your Kudos.
  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Hi mmelerof 

    please try

    Horas Extras =
    SUMX (
    VALUES ( 'Enero 2023'[Empleado] ),
    CALCULATE (
    VAR Extras =
    SUM ( 'Enero 2023'[Horas Trabajadas] ) - 160
    RETURN
    IF ( Extras > 0, Extras, 0 )
    )
    )