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

Filtrado de filas de matriz basadas en columnas de múltiplos

Hola

¿Alguien puede ayudarme con una solución a esto?
Hemos creado un informe Matrix, pero necesitamos filtrar filas en función del valor de al menos dos columnas en una matriz.

ProveedorCorporativaEnergíaDefensa
Proveedor 1Z04MZ06M
Proveedor 2Z06M
Proveedor 3 Z06MZ06M
Proveedor 4Z09M
Proveedor 5Z09MZ03M

Queremos mantener solo el Proveedor 1, 3 y 5.

(y el sueño podría ser sólo mantener el Proveedor 1 & 5 porque el valor no es el mismo)

Gracias por tu ayuda,
Julian.

1 ACCEPTED SOLUTION

@JuliCraps En primer lugar, la tabla debe transformarse para un mejor diseño, básicamente desenrestable la tabla, para desencelar estos pasos:

- transformar datos
- Seleccionar columna de proveedor
- haga clic con el botón derecho del derecho, desdinámica otras columnas agregará dos columnas, atributo y valor, cambiarela según su requisito

- filtrar filas de valores en blanco (no los necesitamos)
- cerrar y aplicar

Para visualizar,
- matriz visual:
- añadir proveedor en filas,
- añadir atributo en las columnas
- añadir valor en la sección de valores

Agregue la siguiente medida:

Count Measure = CALCULATE ( DISTINCTCOUNT ( Vendor[Value] ), ALLEXCEPT ( Vendor, Vendor[Vendor] ) )

y utilizar esta medida como filtro de nivel visual en la matriz anterior visual

image.png

y aquí está el resultado

image.png

Aquí está el script M para despivotar, crear una consulta en blanco y en el editor avanzado pegar el siguiente código:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCi4tKMjJTC1SMFTSUYoyMPEFU2YgSkEpVgdJgRGyDIasMVQYqgJMoSgwAYta4tBuipCNMjAGUUqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Vendor = _t, Corporate = _t, Energy = _t, Defence = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Vendor", type text}, {"Corporate", type text}, {"Energy", type text}, {"Defence", type text}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Vendor"}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each ([Value] <> "" and [Value] <> " "))
in
    #"Filtered Rows"

Me gustaría elogiossi mi solución me ayudó.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para darle a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

Filtro de energía <> En blanco (nivel visual)

O tener una medida como

Calculate(Sum(Table[Value]),not(isblank(Table[Energy])))

@JuliCraps En primer lugar, la tabla debe transformarse para un mejor diseño, básicamente desenrestable la tabla, para desencelar estos pasos:

- transformar datos
- Seleccionar columna de proveedor
- haga clic con el botón derecho del derecho, desdinámica otras columnas agregará dos columnas, atributo y valor, cambiarela según su requisito

- filtrar filas de valores en blanco (no los necesitamos)
- cerrar y aplicar

Para visualizar,
- matriz visual:
- añadir proveedor en filas,
- añadir atributo en las columnas
- añadir valor en la sección de valores

Agregue la siguiente medida:

Count Measure = CALCULATE ( DISTINCTCOUNT ( Vendor[Value] ), ALLEXCEPT ( Vendor, Vendor[Vendor] ) )

y utilizar esta medida como filtro de nivel visual en la matriz anterior visual

image.png

y aquí está el resultado

image.png

Aquí está el script M para despivotar, crear una consulta en blanco y en el editor avanzado pegar el siguiente código:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCi4tKMjJTC1SMFTSUYoyMPEFU2YgSkEpVgdJgRGyDIasMVQYqgJMoSgwAYta4tBuipCNMjAGUUqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Vendor = _t, Corporate = _t, Energy = _t, Defence = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Vendor", type text}, {"Corporate", type text}, {"Energy", type text}, {"Defence", type text}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Vendor"}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each ([Value] <> "" and [Value] <> " "))
in
    #"Filtered Rows"

Me gustaría elogiossi mi solución me ayudó.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para darle a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Muchas gracias @parry2k, es perfecto 🤗.
(Disculpas, mi fuente inicial no fue construida como explico, aprecio su recomendación).

Hola @amitchandak,
el filtro no se basa en la columna "Energía", sino para las filas con un valor en al menos 2 columnas.

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.