Search code examples
excelpowerbipowerquerypowerbi-desktopm

How do one count rows in powerquery table that contain just text values


Good day all,how can one count rows in a table in powerquery containing just text values.

I want my table in this format.

Mail listern Boby TOTAL
B 1 C 2
B 0 3 1

Solution

  • enter image description here

     let
            Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclJQ0lEyBBHOCkqxOlABAxBhDBSIBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Mail " = _t, #"listern " = _t, #"Boby " = _t]),
            #"Added Custom" = Table.AddColumn(Source, "Custom", each 
            let a = Record.ToList(_),
            b = List.Transform(a, each try Number.From(_) otherwise "Text" ),
            c = List.Select(b, each _ = "Text" ),
            d = List.Count(c)
            in d,  Int64.Type)
        in
            #"Added Custom"