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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Syndicate_Admin
Administrator
Administrator

Los empleados activos y resignados cuentan entre un intervalo de fechas

Hola a todos,

Tengo una tabla de empleados activos de cada mes como el siguiente.

FechaEmpleado
2020/12/1David
2020/12/1Jeff
2020/12/1Marco
2020/12/1Alegría
2020/12/1Peter
2021/1/1David
2021/1/1Jeff
2021/1/1Marco
2021/1/1Alegría
2021/1/1Jenny
2021/1/1Kate
2021/2/1Jeff
2021/2/1Marco
2021/2/1Alegría
2021/2/1Jenny
2021/2/1Kate
2021/2/1Aaron

De 2020/12 a 2021/1, 1 persona peter se fue, y 2 personas Jenny y Kate se unieron. De 2021/1 a 2021/2, David se fue y Aaron se unió.

Pero si tuviéramos que mirar de 2020/12 a 2021/2, Peter y David se fueron, y Jenny, Kate y Aaron se unieron.

Quiero poder mostrar cuántas personas se unieron y cuántas personas se fueron, y también la tasa de rotación de un rango de fechas.

Lo siento, pero no puedo pensar en una buena manera de hacer esto. ¡Necesito ayuda para esto, gracias!

Saludos

David

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

No @primolee,

Pruebe la siguiente fórmula para crear medidas:

Left = 
var _First = MIN('Table'[Date])
var _Last = MAX('Table'[Date])
var Table1 = 
    SELECTCOLUMNS(
        FILTER(
            'Table',
            'Table'[Date].[MonthNo] = MONTH(_First)
            &&'Table'[Date].[Year] = YEAR(_First)
        ),
        "Employee",
        'Table'[Employee]
    )
var Table2 = 
    SELECTCOLUMNS(
        FILTER(
            'Table',
            'Table'[Date].[MonthNo] = MONTH(_Last)
            &&'Table'[Date].[Year] = YEAR(_Last)
        ),
        "Employee",
        'Table'[Employee]
    )
return 
    COUNTAX(
        EXCEPT(Table1,Table2),
        [Employee]
)
Joined = 
var _First = MIN('Table'[Date])
var _Last = MAX('Table'[Date])
var Table1 = 
    SELECTCOLUMNS(
        FILTER(
            'Table',
            'Table'[Date].[MonthNo] = MONTH(_First)
            &&'Table'[Date].[Year] = YEAR(_First)
        ),
        "Employee",
        'Table'[Employee]
    )
var Table2 = 
    SELECTCOLUMNS(
        FILTER(
            'Table',
            'Table'[Date].[MonthNo] = MONTH(_Last)
            &&'Table'[Date].[Year] = YEAR(_Last)
        ),
        "Employee",
        'Table'[Employee]
    )
return 
    COUNTAX(
        EXCEPT(Table2,Table1),
        [Employee]
)

v-kkf-msft_0-1614844558442.png

Este es mi archivo PBIX.

https://microsoftapc-my.sharepoint.com/:u:/g/personal/v-lazhang_microsoft_com/EdLs_JfXa4tGl9qGNyvgcy...

Si el problema aún no se ha resuelto, proporcione información detallada sobre errores o el resultado esperado que espera. Hágamelo saber inmediatamente, esperando su respuesta.

Saludos
Winniz

Si esta publicación ayuda, considere Aceptarla como la solución para ayudar a los demás miembros a encontrarla más rápidamente.

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

No @primolee,

Pruebe la siguiente fórmula para crear medidas:

Left = 
var _First = MIN('Table'[Date])
var _Last = MAX('Table'[Date])
var Table1 = 
    SELECTCOLUMNS(
        FILTER(
            'Table',
            'Table'[Date].[MonthNo] = MONTH(_First)
            &&'Table'[Date].[Year] = YEAR(_First)
        ),
        "Employee",
        'Table'[Employee]
    )
var Table2 = 
    SELECTCOLUMNS(
        FILTER(
            'Table',
            'Table'[Date].[MonthNo] = MONTH(_Last)
            &&'Table'[Date].[Year] = YEAR(_Last)
        ),
        "Employee",
        'Table'[Employee]
    )
return 
    COUNTAX(
        EXCEPT(Table1,Table2),
        [Employee]
)
Joined = 
var _First = MIN('Table'[Date])
var _Last = MAX('Table'[Date])
var Table1 = 
    SELECTCOLUMNS(
        FILTER(
            'Table',
            'Table'[Date].[MonthNo] = MONTH(_First)
            &&'Table'[Date].[Year] = YEAR(_First)
        ),
        "Employee",
        'Table'[Employee]
    )
var Table2 = 
    SELECTCOLUMNS(
        FILTER(
            'Table',
            'Table'[Date].[MonthNo] = MONTH(_Last)
            &&'Table'[Date].[Year] = YEAR(_Last)
        ),
        "Employee",
        'Table'[Employee]
    )
return 
    COUNTAX(
        EXCEPT(Table2,Table1),
        [Employee]
)

v-kkf-msft_0-1614844558442.png

Este es mi archivo PBIX.

https://microsoftapc-my.sharepoint.com/:u:/g/personal/v-lazhang_microsoft_com/EdLs_JfXa4tGl9qGNyvgcy...

Si el problema aún no se ha resuelto, proporcione información detallada sobre errores o el resultado esperado que espera. Hágamelo saber inmediatamente, esperando su respuesta.

Saludos
Winniz

Si esta publicación ayuda, considere Aceptarla como la solución para ayudar a los demás miembros a encontrarla más rápidamente.

Hola @v-kkf-msft

Acabo de estudiar sus códigos, esto es increíble! ¡Muchas gracias!

Saludos

David

Syndicate_Admin
Administrator
Administrator

@primolee , es como una tabla de instantáneas?

Compruebe el enfoque de Mes a mes usando isblank para la retención de clientes, que debe ayudar

Parte 1 de retención del cliente:
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/b...
Retención de clientes Parte 2: Período durante la retención del período :https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retenti...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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