Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
sophtee
Frequent Visitor

How to combine or group multiple column into a new table

Hello everyone,

I would like to combine or group multiple columns of related row and place into a new table.

For example:I would like to have another table with HchID , Flk (Flk1 & Flk2) and respective Qty. Please note that I am using this data for other reports.

sophtee_1-1710339618468.png

So I would like the new table to be T2:

sophtee_0-1710341315207.png

 

 

 

2 ACCEPTED SOLUTIONS
wstegemann
Frequent Visitor

Hi @sophtee,

 

If you have the source data available in power query, you can do the following:

 

  1. Duplicate the source table in power query (do this twice if you would like to keep a copy of the source table)
  2. Remove the flk2 and qty2 columns from the original table
  3. Remove the flk1 and qty1 columns from the duplicated table
  4. Rename the remaining flk and qty columns so that the columns on both tables are named the same
  5. Append the original table and the duplicated table
  6. Optionally filter to remove blanks

wstegemann_0-1710344924801.png

 

View solution in original post

v-yohua-msft
Community Support
Community Support

Hi, @sophtee 

Based on your information, I create a table:

 

vyohuamsft_0-1710399085015.png

 

You can use DAX to create what you want. Create two new tables, get data for 1 and 2, and combine them together

 

vyohuamsft_1-1710399514861.png

Table1 = SELECTCOLUMNS('Table', "HchID", 'Table'[HchID], "Flk", 'Table'[Flk1], "Qty", 'Table'[Qty1])

 

vyohuamsft_2-1710399554606.png

Table2 = SELECTCOLUMNS('Table', "HchID", 'Table'[HchID], "Flk", 'Table'[Flk2], "Qty", 'Table'[Qty2])

 

vyohuamsft_3-1710399596730.png

FinalTable = UNION(Table1, Table2)

 

How to Get Your Question Answered Quickly 

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

2 REPLIES 2
v-yohua-msft
Community Support
Community Support

Hi, @sophtee 

Based on your information, I create a table:

 

vyohuamsft_0-1710399085015.png

 

You can use DAX to create what you want. Create two new tables, get data for 1 and 2, and combine them together

 

vyohuamsft_1-1710399514861.png

Table1 = SELECTCOLUMNS('Table', "HchID", 'Table'[HchID], "Flk", 'Table'[Flk1], "Qty", 'Table'[Qty1])

 

vyohuamsft_2-1710399554606.png

Table2 = SELECTCOLUMNS('Table', "HchID", 'Table'[HchID], "Flk", 'Table'[Flk2], "Qty", 'Table'[Qty2])

 

vyohuamsft_3-1710399596730.png

FinalTable = UNION(Table1, Table2)

 

How to Get Your Question Answered Quickly 

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

wstegemann
Frequent Visitor

Hi @sophtee,

 

If you have the source data available in power query, you can do the following:

 

  1. Duplicate the source table in power query (do this twice if you would like to keep a copy of the source table)
  2. Remove the flk2 and qty2 columns from the original table
  3. Remove the flk1 and qty1 columns from the duplicated table
  4. Rename the remaining flk and qty columns so that the columns on both tables are named the same
  5. Append the original table and the duplicated table
  6. Optionally filter to remove blanks

wstegemann_0-1710344924801.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.