Forum Discussion

stanislav_dugas's avatar
stanislav_dugas
Icon for Helper III rankHelper III
5 years ago
Solved

Combining several columns and creating cascading structure

Hi Guys,

 

I am working on a problem i have. Hopefully someone can help me with it.

 

I created a unique new Table outof my main data source that looks like this. Value 1 and 2 are Meassures or i can change them to new Columns whichever is needed.

IDValue 1Value 2
1

10

15
22025
33035

 

Out of this i would like to create a cascaded structure like this.

IDValue
110
220
330
115
225
335

 

Is there any way how to do it?

Thx for any advice. 

  • PaulDBrown's avatar
    PaulDBrown
    5 years ago

    stanislav_dugas 

    Actually the function you need (to avoid including other columns which ADDCOLUMNS does) is SELECTCOLUMNS. My apologies.

     

    Here is the example:

5 Replies

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

    If you create the table in Power Query, all you have to do is unpivot both values columns

    • stanislav_dugas's avatar
      stanislav_dugas
      Icon for Helper III rankHelper III

      Problem is I cant access this table in query editor since it was created as a new table by using Groupby function from the main data table.

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

        stanislav_dugas 

         

        Ok. Try:

        New table = 
        VAR _table1 = ADDCOLUMNS(Table, "ID", Table [ID], "Value", Table [Value 1])
        VAR _table2 = ADDCOLUMNS(Table, "ID", Table [ID], "Value" Table [Value 2])
        RETURN
        UNION(_table1, _table2)