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
Syndicate_Admin
Administrator
Administrator

Marcar filas por varias condiciones

Hola a todos

Tengo los siguientes datos de ejemplo que estoy intentando usar para crear una nueva columna que marque cuándo un inquilino permanece o se va.

Esperado Columna es lo que estoy persiguiendo:

EntradaNoFechaPropiedadN InclusiveEdificioN inclusivoTítuloTenantN IncluidoQuebrarQue DaBefRecDespuésTES_Title_First EntradaDespués2CorrectoEsperado
17329/04/2021 12:34Propiedad AEdificio AUnidad CCliente1 31/12/2019 00:0000111
17329/04/2021 13:30Propiedad AEdificio AUnidad CCliente1 31/12/2021 00:0000000 Permanecía
17330/04/2021 14:42Propiedad AEdificio AUnidad CCliente1 31/12/2021 00:0000000
17309/05/2021 16:45Propiedad AEdificio AUnidad CCliente112/04/2021 00:0031/12/2021 00:0000000
17309/05/2021 17:45Propiedad AEdificio AUnidad CCliente102/05/2021 00:0031/12/2021 00:0000000
17321/05/2021 13:44Propiedad AEdificio AUnidad CCliente102/05/2021 00:0031/12/2021 00:0010000
17321/05/2021 13:44Propiedad AEdificio AUnidad CCliente1 31/12/2021 00:0001000PermanecíaPermanecía
17321/05/2021 15:12Propiedad AEdificio AUnidad CVacante 31/12/2021 00:0000100IzquierdaIzquierda
17322/05/2021 11:41Propiedad AEdificio AUnidad CVacante 31/12/2021 00:0000000
17323/05/2021 19:43Propiedad AEdificio AUnidad CVacante 31/12/2021 00:0000000
17323/05/2021 19:43Propiedad AEdificio AUnidad CVacante 31/12/2021 00:0000000
17323/05/2021 19:43Propiedad AEdificio AUnidad CVacante 31/12/2021 00:0000000
17324/05/2021 00:56Propiedad AEdificio AUnidad CVacante15/09/2021 00:0031/12/2021 00:0000000
17324/05/2021 01:21Propiedad AEdificio AUnidad CVacante30/09/2021 00:0031/12/2021 00:0000000
17324/05/2021 01:26Propiedad AEdificio AUnidad CVacante 31/01/2022 00:0000000
17324/05/2021 01:38Propiedad AEdificio AUnidad CVacante 06/02/2022 00:0010000
17324/05/2021 01:38Propiedad AEdificio AUnidad CVacante 06/02/2022 00:0001000
17324/05/2021 01:40Propiedad AEdificio AUnidad CCliente3 06/02/2022 00:0000101
17323/08/2021 09:53Propiedad AEdificio AUnidad CCliente3 06/02/2022 00:0000000
17323/08/2021 09:57Propiedad AEdificio AUnidad CCliente3 06/02/2022 00:0010000
17323/08/2021 09:57Propiedad AEdificio AUnidad CCliente3 06/02/2022 00:0001000Permanecía

Lógica:

  • Cuando un cliente cambia a uno nuevo, el estado debe ser "Izquierda"
  • Cuando un cliente sigue siendo el mismo pero la fecha de finalización cambia a la fecha futura, el estado debe ser "Permanecer"
  • Cuando un cliente sigue siendo el mismo pero rompe los cambios en el futuro, el estado debe ser "Permanecer"
  • Cuando cliente = "Vacante" y la entrada anterior se <> "Vacante", el estado debe ser "Izquierda"

Usando el siguiente código y después de crear varias columnas "Antes / Reciente / Después" pude crear la columna "RET" pero aún no está bien, ¿puede ayudar?

Ret = 
VAR TenantB = CALCULATE(VALUES('Table'[TenantN Inclusive]), 'Table'[bef] = 1)
VAR TenantC = CALCULATE(VALUES('Table'[TenantN Inclusive]), 'Table'[rec] = 1)

VAR BreakPRe = CALCULATE(VALUES('Table'[Break]), 'Table'[bef] = 1)
VAR BreakCurr = CALCULATE(VALUES('Table'[Break]), 'Table'[rec] = 1)

VAR TenantAA = CALCULATE(VALUES('Table'[TenantN Inclusive]), 'Table'[After] = 1)

VAR IFs = IF(
            'Table'[TenantN Inclusive] = "Vacant - LCR"
            || 'Table'[bef] = 0  &&  'Table'[rec] = 0
            || 'Table'[bef] = 1,
        BLANK(),
        IF( 
            OR(BreakPRe < BreakCurr || TenantB = TenantC,
                BreakCurr = BLANK() && BreakPRe <> BLANK()
                ),
        "False",
        "True"))

VAR GUR = SWITCH(
                TRUE(),
                IFs = "True", "Remained",
                'Table'[After] = 0, BLANK(),
                'Table'[TES_Title_First Entry] = 1, BLANK(),
                TenantC <> TenantAA || TenantC = "Vacant", "Left",
                "Left")

VAR IFY = IF('Table'[After2] = 1, BLANK(), GUR)


Return
IFY

Estoy tan cerca...

Gracias

H

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Hay @Calvin69

Cuáles son los valores de los campos 'Tabla'[TES_Title_First Entrada] y 'Tabla'[Después2] , En los datos que proporcionaste, no encontré estos dos campos. ¿Puede proporcionar los valores de estos dos campos?

Saludos

Equipo de apoyo a la comunidad _ Ailsa Tao

Gracias @Ailsa-msft por investigar esto y disculpas por la respuesta tan tardía.

He modificado los datos de la tabla para incluir las columnas que faltan.

Gracias de antemano.

H

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.