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.
Hola
Estoy trabajando en la construcción de la funcionalidad de volumen de negocios y necesito conocer el número de empleados en un momento determinado. Los datos transaccionales que estoy usando se ven algo como esto:
Id. de empleado | Fecha del evento | Estado |
1 | 1/1/20 | Activo |
2 | 1/1/20 | Activo |
3 | 2/1/20 | Activo |
1 | 3/1/20 | Terminado |
2 | 3/1/20 | Activo |
3 | 3/1/20 | Activo |
1 | 4/1/20 | Activo |
Sobre la base de los datos transaccionales anteriores, esperaría ver el número de empleados de fin de mes para cada mes a ser: Enero , 2, Febrero 3, Marzo - 2, Abr - 3.
Los empleados tendrán varias transacciones para su ID de empleado.
Cualquier ayuda es muy apreciada!
Solved! Go to Solution.
@dupreem -
Measure 14 =
VAR __Date = MAX([Event Date ])
VAR __Active = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table (14)'),[Event Date ]<=__Date && [Status]="Active"),"ID",[Employee ID ]))
VAR __Term = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table (14)'),[Event Date ]<=__Date && ([Status]="Terminated" || [Status]="Retiree" || [Status]="Dead")),"ID",[Employee ID ]))
RETURN
COUNTROWS(EXCEPT(__Active, __Term))
@dupreem - Ver archivo PBIX adjunto a continuación sig, Página 14
Measure 14 =
VAR __Date = MAX([Event Date ])
VAR __Active = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table (14)'),[Event Date ]<=__Date && [Status]="Active"),"ID",[Employee ID ]))
VAR __Term = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table (14)'),[Event Date ]<=__Date && [Status]="Terminated"),"ID",[Employee ID ]))
RETURN
COUNTROWS(EXCEPT(__Active, __Term))
@Greg_Deckler ¡Muchas gracias! Si tengo varios estados "Terminado" (es decir, "Terminado, Retirado), ¿cómo actualizaría la Medida?
@dupreem -
Measure 14 =
VAR __Date = MAX([Event Date ])
VAR __Active = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table (14)'),[Event Date ]<=__Date && [Status]="Active"),"ID",[Employee ID ]))
VAR __Term = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table (14)'),[Event Date ]<=__Date && ([Status]="Terminated" || [Status]="Retiree" || [Status]="Dead")),"ID",[Employee ID ]))
RETURN
COUNTROWS(EXCEPT(__Active, __Term))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |