Forum Discussion

calculateadvers's avatar
calculateadvers
Frequent Visitor
5 years ago
Solved

Dynamically expand tables in columns

In the example below, how would I add a step to go through the "condition" column and expand Tables? I would want Row 9 to expand into two rows, where one has [condition] as "Cardiovascular Diseases" and one as "Coronary Disease". Then I should have a total of 10 Rows.

 

 

  • calculateadvers 

    One quick way to do it is to duplicate your query, filter the condition column to Table  and click onthe column header to expand into two rows. 

    Filter out the rows with Table in the original query and append with the duplicated query.

    ________________________

    If my answer was helpful, please click Accept it as the solution to help other members find it useful

    Click on the Thumbs-Up icon if you like this reply ๐Ÿ™‚


    Website YouTube  LinkedIn
     

3 Replies

  • calculateadvers 

    One quick way to do it is to duplicate your query, filter the condition column to Table  and click onthe column header to expand into two rows. 

    Filter out the rows with Table in the original query and append with the duplicated query.

    ________________________

    If my answer was helpful, please click Accept it as the solution to help other members find it useful

    Click on the Thumbs-Up icon if you like this reply ๐Ÿ™‚


    Website YouTube  LinkedIn
     

    • calculateadvers's avatar
      calculateadvers
      Frequent Visitor

      Thanks Fowmy .

       

      I considered that as an option, but I ran into a roadblock trying to figure out how to filter a column to show only Table or non-Table.

       

      In the Power Query Interface for the filter dropdown, Table  does not appear as one of the options for filtering. Only the text in rows that are not Table display.

       

      How do I filter only to show rows where [condition] is Table ?

  • CNENFRNL's avatar
    CNENFRNL
    Icon for Community Champion rankCommunity Champion

    calculateadvers , you might want to uncheck all those undesired options in the dropdown list

    or use M code to sort out more specifically options you need.

    let
        Source = #table({"id","options"},{{"id1",1},{"id2",#table({"col"},{{"x"}})},{"id3",{100,2}},{"id4","zyx"},{"id5",{}}}),
    
        #"Filtered Rows" = Table.SelectRows(Source, each Value.Is([options], List.Type) and [id]="id5")
    
    in
        #"Filtered Rows"