Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RicardoLeivaG
Helper I
Helper I

Calcute de horas

Hola comunidad, 

tengo el siguiente tema tengo una medida que suma una diferencia de entre horas (H:nn), hasta ahi todo bien funciona perfecto, pero pasa que un dia dd/mm/aaaa = 05/09/2022, a la hora de atraso debo restarle 1 hora, por un fallo en el motor de SQL, me explico, si la persona entraba a las 07:00, pero marco a las 08:22, enves de sumar 1:22, debo sumar solo 0:22, esta es la funcion

 

Atrasos v2 =
        VAR __sumatrasos =
        CALCULATE
                (SUM(T_MARCA_LINEA[tiempo atrasos]),
                FILTER(T_MARCA_LINEA,T_MARCA_LINEA[Hora Entrada]>=T_MARCA_LINEA[Hora oficina]),
                FILTER(T_MARCA_LINEA,T_MARCA_LINEA[Hora Entrada]<= T_MARCA_LINEA[SALIDA]))
        RETURN __sumatrasos
 
¿como puedo agregar esa excepcion?
1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @RicardoLeivaG ,

 

I think you can try this code to calcualte the datetime you want.

Delays v2 =
VAR __sumatrasos =
    CALCULATE (
        SUM ( T_LINE_MARK[time delays] ),
        FILTER ( T_LINE_MARK_MARK, T_LINE_MARK[Entry Time] >= T_LINE_MARK[Office Time] ),
        FILTER (
            T_LINE_MARK_LINE,
            T_LINE_LINE_MARK[Time In] <= T_LINE_LINE_MARK[Time Out]
        )
    )
VAR _CONVERT =
    __sumatrasos
        - TIME ( HOUR ( __sumatrasos ) - 7, 0, 0 )
RETURN
    _CONVERT

 

Best Regards,
Rico Zhou

 

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

View solution in original post

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @RicardoLeivaG ,

 

I think you can try this code to calcualte the datetime you want.

Delays v2 =
VAR __sumatrasos =
    CALCULATE (
        SUM ( T_LINE_MARK[time delays] ),
        FILTER ( T_LINE_MARK_MARK, T_LINE_MARK[Entry Time] >= T_LINE_MARK[Office Time] ),
        FILTER (
            T_LINE_MARK_LINE,
            T_LINE_LINE_MARK[Time In] <= T_LINE_LINE_MARK[Time Out]
        )
    )
VAR _CONVERT =
    __sumatrasos
        - TIME ( HOUR ( __sumatrasos ) - 7, 0, 0 )
RETURN
    _CONVERT

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors