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
Merleau
Helper II
Helper II

Recuento de filas no vacías

Hola

Tengo más de 30 columnas en mi informe "tabla", algunas con valor de texto. La tabla tiene más de 600 filas. Me gustaría mostrar para cada columna, el número de filas no en blanco. El resultado debe ser similar a "NonBlank" en la figura siguiente.

Id

Xy

Fecha

Yz

Yt

Tt

Dirección

Contar

Phone_nber

1

Xy

5/5/1990

Yt

Tt

12 tribunal rd

3

4678*

2

Xy

Yz

Yt

3

377*

3

6/6/1966

Yt

Tt

15 pavillon rd

2

NonBlank

2

2

1

3

2

2

3

2

Usando la opción "Count" simplemente reemplaza el texto con "1", pero me gustaría que el texto permaneciera como es "No resumir".

Además

Count_nonblanks: CALCULATE(COUNT(My_Table[ID]), My_Table [column_name]<> BLANK())

Calculará una columna a la vez, no es posible con más de 30 columnas.

¿Alguien puede ayudar?

Gracias

1 REPLY 1
dax
Community Support
Community Support

Hola @Merleau ,

Puede probar a continuación el código M para ver si funciona o no.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTq0ICISSJnqm+obWloaAJlAFBkCJEJAhKGRQnJ+aVGJQlEKkGcMxCZm5hZaSrE60UpGCO0gPVEwjRAEUmtsbg5RagwRM9M3A9piZoZhi6lCQWJZZk5Ofh7EIpDRSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [ID = _t, XY = _t, Date = _t, YZ = _t, YT = _t, TT = _t, Address = _t, Count = _t, Phone_nber = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"XY", type text}, {"Date", type date}, {"YZ", type text}, {"YT", type text}, {"TT", type text}, {"Address", type text}, {"Count", Int64.Type}, {"Phone_nber", type text}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"ID"}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each [Value] <> null and [Value] <> ""),
    #"Grouped Rows" = Table.Group(#"Filtered Rows", {"Attribute"}, {{"Count NO", each Table.RowCount(_), type number}, {"all", each _, type table [ID=number, Attribute=text, Value=anynonnull]}}),
    #"Expanded all" = Table.ExpandTableColumn(#"Grouped Rows", "all", {"ID", "Value"}, {"ID", "Value"})
in
    #"Expanded all"

Saludos
Zoe Zhi

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

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.