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
luis2810
Frequent Visitor

Número de empleados

Hola

Soy relativamente nuevo en PowerBI - DAX
Tengo una duda,
Quiero crear una medida que muestre en cada "Fecha" de mi tabla "Fecha y hora" el número de empleados.
Para hacer eso que tengo,
una mesa con

CódigoTiempo de entradaFiredTimeContrato final
00101-01-201002-05-2010
00201-04-2010 01-09-2012
00301-05-2010

y un horario de mesa con todas las fechas.
el resultado que me gustaría es

FechaNúmero de empleados
01-01-20101
...1
01-04-20102
...2
01-05-20103
02-05-20102

Gracias

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User
2 REPLIES 2
v-yingjl
Community Support
Community Support

Hola @luis2810 ,

Puede probar esta medida:

Result = 
VAR _date =
    SELECTEDVALUE ( 'Date Time'[Date] )
VAR tab =
    SUMMARIZE (
        ALL ( 'Table' ),
        'Table'[Code],
        'Table'[Entry Time],
        'Table'[Fired Time],
        'Table'[Ending Contract],
        "flag", IF (
            NOT ( ISBLANK ( [Fired Time] ) ),
            IF ( ( _date >= [Entry Time] && _date < [Fired Time] ), 1, 0 ),
            IF (
                NOT ( ISBLANK ( [Ending Contract] ) ),
                IF ( _date >= [Entry Time] && _date < [Ending Contract], 1, 0 ),
                IF ( _date >= [Entry Time], 1, 0 )
            )
        )
    )
RETURN
    SUMX ( FILTER ( tab, [flag] = 1 && NOT ( ISBLANK ( [Code] ) ) ), [flag] )

El resultado puede ser su esperada:

r1.pngr2.png

Adjunto mi archivo de muestra que espera ayudarle: Contar el número de empleados.pbix

Best Looks,
Yingjie Li

Si este post ayuda, por favor considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

amitchandak
Super User
Super User

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.