Forum Discussion

kalleleander's avatar
kalleleander
New Member
3 years ago
Solved

Create a table with multiple data in same row

Hi, I am trying to make a table similar to an Excel table in Power BI. An example query looks like this:   And the table that I have made looks like this:     I wish for a table whe...
  • ImkeF's avatar
    3 years ago

    Hi kalleleander ,
    unfortunately you have to use some M-code here. Please paste the following code into the advanced editor and follow the steps:

    let
        Source = Table.FromRows(
            Json.Document(
                Binary.Decompress(
                    Binary.FromText("i45WMlTSUVKK1YlWAtLGYIYRkogJjAGjTZViYwE=", BinaryEncoding.Base64), 
                    Compression.Deflate
                )
            ), 
            let
                _t = ((type nullable text) meta [Serialized.Text = true])
            in
                type table [Column1 = _t, Column2 = _t]
        ), 
        #"Changed Type" = Table.TransformColumnTypes(Source, {{"Column1", Int64.Type}, {"Column2", Int64.Type}}), 
        Custom1 = List.Transform(
            Table.ToColumns(#"Changed Type"), 
            each List.Select(_, (l) => l <> null and l <> "")
        ), 
        Custom2 = Table.FromColumns(Custom1)
    in
        Custom2

    In there, you split up the table into a list of single columns (which will then become list objects). 
    Next, you filter those list objects so no empty fields will be in there any more.
    Then you re-assemble to a table again.