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
tonmcg
Resolver II
Resolver II

Encontrar n Número de eventos entre dos eventos

Tengo la siguiente tabla, FactEvent. Detalla todos los eventos que un empleado registra todos los días. Necesito categorizar cada evento como un evento de trabajo, ya sea TRUE o FALSE. Un evento de trabajo es cualquier evento que se produce entre los eventos CLOCK IN y CLOCK OUT, inlcusive de un evento CLOCK OUT.

En el ejemplo siguiente, he categorizado incorrectamente los dos eventos entre un período CLOCK IN y CLOCK OUT como TRUE, el evento Badge to Breakroom a las 10:24 AM y el evento Badge to Arcade a las 10:34 AM, definido en la columna isWorkEvent. Necesito que estos dos eventos sean FALSE, como se muestra en la columna isWorkEvent2.

ÍndiceDateIDReloj diario en el índiceDaily Clock Out IndexEmpleadoDatetimeEventoTimeOffisWorkEventisWorkEvent2
1120200110111John Smith1/10/2020 15:45CLOCK OUT VerdadVerdad
1020200110111John Smith1/10/2020 15:30Final de la última tarea VerdadVerdad
920200110111John Smith1/10/2020 10:37RELOJ EN FalsoFalso
820200110111John Smith1/10/2020 10:37CLOCK OUTAlmuerzo sin pagarFalsoFalso
720200110111John Smith1/10/2020 10:34Insignia a Arcade VerdadFalso
620200110111John Smith1/10/2020 10:24Insignia a Breakroom VerdadFalso
520200110111John Smith1/10/2020 10:13RELOJ ENAlmuerzo sin pagarFalsoFalso
420200110111John Smith1/10/2020 10:13CLOCK OUT VerdadVerdad
320200110111John Smith1/10/2020 10:04Insignia a Breakroom VerdadVerdad
220200110111John Smith1/10/2020 10:02Primer final de tarea VerdadVerdad
120200110111John Smith1/10/2020 6:00RELOJ EN FalsoFalso

Aquí es cómo calculé actualmente isWorkEvent:

isWorkEvent á FactEvent[Index] >-FactEvent[Daily Clock In Index] && FactEvent[Index] <-FactEvent[Daily Clock Out Index] && ISBLANK( FactEvent[TimeOffID] ) && FactEvent[Event] <> "CLOCK IN"

¿Cómo puedo ajustar isWorkEvent para que los dos eventos entre los eventos 10:13 AM CLOCK IN y 10:37 AM CLOCK OUT sean FALSE?

2 REPLIES 2
v-eachen-msft
Community Support
Community Support

Hola @tonmcg ,

Puede hacer referencia al siguiente DAX:

isWorkEvent =
VAR a =
    CALCULATE (
        MAX ( FactEvent[Index] ),
        FILTER ( FactEvent, FactEvent[TimeOff] = "Unpaid Lunch" )
    )
VAR b =
    CALCULATE (
        MIN ( FactEvent[Index] ),
        FILTER ( FactEvent, FactEvent[TimeOff] = "Unpaid Lunch" )
    )
RETURN
    ( FactEvent[Index] >= FactEvent[Daily Clock In Index] )
    && ( FactEvent[Index] <= FactEvent[Daily Clock Out Index] )
    && ( FactEvent[TimeOff] = BLANK () )
    && ( FactEvent[Event] <> "CLOCK IN" )
    && OR ( FactEvent[Index] > a, FactEvent[Index] < b )

Aquí está el resultado.

2-1.PNG

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Greg_Deckler
Super User
Super User

Parece que sólo comprobaría si la última

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.