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
gab2020
Employee
Employee

Múltiples segmentaciones de varias columnas

Hola

Tengo una tabla creada como sigue en Power BI.

gab2020_1-1595927666503.png

Cómo crear 2 segmentaciones de datos para filtrar la tabla de la siguiente manera:

IdentityNo. Slicer: una segmentación de datos con valores de IdentityNo. 1, IdentityNo. 2 e IdentityNo. 3.

Por ejemplo, al seleccionar 9232039 en la segmentación de datos se filtrará la tabla y se generará toda la 2a fila.

IdentityCountry Slicer: ¿Una segmentación con valores de IdentityCountry 1, IdentityCountry 2, IdentityCountry 3?

Por ejemplo, al seleccionar MY en la segmentación de datos se filtrará la tabla y se generarán las filas 2 y 3.

¿Cómo crear una tarjeta para hacer un recuento distinto de valores de IdentityCountry 1, IdentityCountry 2, IdentityCountry 3?

Por ejemplo, la tarjeta del Reino Unido mostrará un total de 3 ya que el Reino Unido aparece 3 veces en las filas 2a, 3a, 4a.

Gracias. 🙂

8 REPLIES 8
v-alq-msft
Community Support
Community Support

Hola, @gab2020

Según su descripción, creé datos para reproducir su escenario. El archivo pbix se adjunta al final.

Mesa:

a1.png

Slicer No (una tabla calculada):

Slicer No = 
FILTER(
    DISTINCT(
        UNION(
            DISTINCT('Table'[IdentityNo.1]),
            DISTINCT('Table'[IdentityNo.2]),
            DISTINCT('Table'[IdentityNo.3])
        )
    ),
    [IdentityNo.1]<>BLANK()
)

País de la cortadora:

Slicer Country = 
FILTER(
    DISTINCT(
        UNION(
            DISTINCT('Table'[IdentityCountry 1]),
            DISTINCT('Table'[IdentityCountry 2]),
            DISTINCT('Table'[IdentityCountry 3])
        )
    ),
    [IdentityCountry 1]<>BLANK()
)

Puede crear dos medidas como se indica a continuación.

Visual Control = 
IF(
    AND(
        SELECTEDVALUE('Table'[IdentityNo.1]) in DISTINCT('Slicer No'[IdentityNo])||
        SELECTEDVALUE('Table'[IdentityNo.2]) in DISTINCT('Slicer No'[IdentityNo])||
        SELECTEDVALUE('Table'[IdentityNo.3]) in DISTINCT('Slicer No'[IdentityNo]),
        SELECTEDVALUE('Table'[IdentityCountry 1]) in DISTINCT('Slicer Country'[IdentityCountry])||
        SELECTEDVALUE('Table'[IdentityCountry 2]) in DISTINCT('Slicer Country'[IdentityCountry])||
        SELECTEDVALUE('Table'[IdentityCountry 3]) in DISTINCT('Slicer Country'[IdentityCountry])
    ),
    1,0
)

Count UK = 
var tab = 
ADDCOLUMNS(
    'Table',
    "flag",
    IF(
        AND(
            'Table'[IdentityNo.1] in DISTINCT('Slicer No'[IdentityNo])||
            'Table'[IdentityNo.2] in DISTINCT('Slicer No'[IdentityNo])||
            'Table'[IdentityNo.3] in DISTINCT('Slicer No'[IdentityNo]),
            'Table'[IdentityCountry 1] in DISTINCT('Slicer Country'[IdentityCountry])||
            'Table'[IdentityCountry 2] in DISTINCT('Slicer Country'[IdentityCountry])||
            'Table'[IdentityCountry 3] in DISTINCT('Slicer Country'[IdentityCountry])
        ),
        1,0
    )
)
return
COUNTROWS(
    FILTER(
        tab,
        [flag]=1&&
        [IdentityCountry 1]="UK"
    )
)+
COUNTROWS(
    FILTER(
        tab,
        [flag]=1&&
        [IdentityCountry 2]="UK"
    )
)+
COUNTROWS(
    FILTER(
        tab,
        [flag]=1&&
        [IdentityCountry 3]="UK"
    )
)

Por último, puede poner la medida 'Control visual' en el filtro de nivel visual y usar 'IdentityNo', 'IdentityCountry' de 'Slicer No', 'Slicer Country' para filtrar el resultado.

a2.png

a3.png

a4.png

Saludos

Allan

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

Gracias @v-alq-msft . 😀 Lo tengo funcionando según el intercambio.

amitchandak
Super User
Super User

@gab2020, crear segmentación de datos independiente, no se una a ninguno de los países. O utilice la unión cruzada para eliminar la unión

Entonces intenta como

medida :
var _max - selectedvalue(Country[country])
devolución
calculate(count(Table[identity No]) , filter(Table , Table[IdentityCountry 1] á _max && Table[IdentityCountry 2] á _max && Table[IdentityCountry 3] á _max ))

medida :
var _max á allselected(Country[country]) // o use // values(Country[country])
devolución
calculate(count(Table[identity No]) , filter(Table , Table[IdentityCountry 1] en _max && Table[IdentityCountry 2] en _max && Table[IdentityCountry 3] en _max ))

Usted puede hacer lo mismo para otra cortadora también

hay un ejemplo de filtro cruzado aquí

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Hola @amitchandak , no estoy seguro de si entiendo la segmentación independiente correctamente.

¿Quieres decir agregar segmentación de datos individualmente por columna?

Estoy buscando tener 2 segmentaciones de datos separadas para generar la tabla en función de la selección de columnas similares en IdentityNo. y IdentityCountry.

@gab2020 , tener una tabla con toda la identidad y una de todas IdentityCountry. No los unas con su mesa. Utilícelo solo en la segmentación de datos.

cómo crear una tabla a partir de salir de la columna

https://www.dropbox.com/s/op9lb78w9utdonz/Distinct%20from%20two%20Tables.pbix?dl=0

compruebe cómo se ha creado la nueva columna.

Hola @amitchandak, he creado las segmentaciones de según su uso compartido.

Sin embargo, no se pueden cortar los datos. Por favor, consulte los detalles en el siguiente enlace.

https://www.dropbox.com/s/my4d2pz2pne3gom/test.pbix?dl=0

Por ejemplo, seleccionó MY en IdentityCountry Slicer y esperando que las filas 2 y 3 de la tabla se generen, pero no funciona como se esperaba.

Gracias.

gab2020_0-1595988731618.png

@gab2020 no se puede abrir el archivo. Está diciendo que necesito una versión superior. Más alto que julio de 2020 🤔

Hola @amitchandak, está bien. Consigue que ya funcione. Gracias por tu consejo también. Muy apreciado. 😀

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.