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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
erasm_w
Frequent Visitor

Función DateDiff entre variables cambiantes

Estoy tratando de calcular la diferencia de tiempo entre las condiciones.

El flujo de trabajo es el siguiente, hay un trabajo creado (Prim_ID_Fk) y cada vez que el proceso de trabajo cambia escribe en una tabla de seguimiento que agrega el Prim_ID_FK como el trabajo, agrega una nueva descripción del proceso y una marca de tiempo cuando el trabajo cambió.

¿Hay alguna manera de mostrar por trabajo el chagne de la descripción del trabajo antiguo al nuevo y la diferencia de tiempo de cuándo se actualizó?

Hay 11 procesos de trabajo:

Envío, Prelavado, Tira, Asiment, Cita, Go_Ahead, Lavado, Montaje, Prueba, Spray, Despacho/Entrega

Esta descripción puede existir en cualquier combinación

Me gustaría mostrar:

Prim_ID_FK Proceso (último) Proceso (nuevo) Tiempo de tiempo ?

1 Prueba de envío 02:10

1 Prueba PreLavado 01:15

1 PreWash Spray 00:25

2 Envío Prelavado 00:45

.......

DIFF = 
    VAR Current_Job=LASTNONBLANK(aas_wf_track_tbl[Prim_ID_FK],[Prim_ID_FK])
    VAR Current_Date=MAX(aas_wf_track_tbl[Track_Date])
    VAR Current_State=LASTNONBLANK(aas_wf_track_tbl[Process_Description],[Process_Description])
    VAR Min_Date=SWITCH(Current_State,"Despatch", Current_Date,"Despatch",MAXX(FILTER(ALL(aas_wf_track_tbl),
        [Prim_ID_FK]=Current_Job&&[Track_Date]<Current_Date),[Track_Date]))
    VAR Max_Date=SWITCH(Current_State,"Despatch",MINX(FILTER(ALL(aas_wf_track_tbl),
        [Prim_ID_FK]=Current_Job&&[Track_Date]<Current_Date),[Track_Date]),"Test",Current_Date)
    RETURN
    DATEDIFF(Min_Date,Max_Date,MINUTE)

3 REPLIES 3
Greg_Deckler
Super User
Super User

Vea mi artículo sobre el tiempo medio entre el error (MTBF) que utiliza EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

¿Estos procesos sólo viajan de izquierda a derecha? o pueden moverse hacia atrás, etc? también es esto en una tabla, tengo un soultion para esto en el Editor de consultas que usamos para el estado de campo.

Gracias

Dobby

Puede ir de izquierda a derecha el orden puede cambiar, sombrero de pensamiento es la única cosa que lo hace más difícil debido a las permutaciones, también puede saltarse una etapa.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors