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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
generaluser
Regular Visitor

Converting multiple columns into 1 column

Hi,

 

I would like to group multiple columns into one column. I have the product name in column A, and then the units by month in the columns after. I would like to keep column A as the product name, have column B as the month and then column C as the units.

 

An example below of current data format:

 

ProductJan-17Feb-17Mar-17Apr-17May-17Jun-17
Prod A              7,598              6,595               16,542               13,635               13,955              1,401
Prod B                  444                  341                     394                     277                     277              1,859
Prod C                  241                  213                     215                     374                     398              2,462
Prod D                  110                    26                       12                       62                       62              2,573
Prod E                  938              3,799                 3,388                 1,226                 1,226              2,643

 

An example below of desired data format:

 

ProductMonthUnits
Prod AJan-17       7,598
Prod BJan-17          444
Prod CJan-17          241
Prod DJan-17          110
Prod EJan-17          938
Prod AFeb-17       6,595
Prod BFeb-17          341
Prod CFeb-17          213
Prod DFeb-17            26
Prod EFeb-17       3,799
Prod AMar-17     16,542
Prod BMar-17          394
Prod CMar-17          215
Prod DMar-17            12
Prod EMar-17       3,388
Prod AApr-17     13,635
Prod BApr-17          277
Prod CApr-17          374
Prod DApr-17            62
Prod EApr-17       1,226
Prod AMay-17     13,955
Prod BMay-17          277
Prod CMay-17          398
Prod DMay-17            62
Prod EMay-17       1,226
Prod AJun-17       1,401
Prod BJun-17       1,859
Prod CJun-17       2,462
Prod DJun-17       2,573
Prod EJun-17       2,643

 

Does anybody know how to quickly do this using Power Query?

 

Thanks

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

In the Query Editor

1) select the Product Column

2) Transform tab - Unpivot Columns - Unpivot Other Columns

3) Rename the Attribute and Values columns - Month and Units

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi. 

I have a similar situation. 

Column A Column Sales1   Column Sales 2    Sales Total 

BEN                 NULL                       400

LISA                 1000                        NULL

MEG                 2500                       NULL

 

I would like to have Total Sales - wather it is sum or not it doesnt matter, as the columns Sales1 and Sales2 are DAX(calculated) columns- I habe already sum from different tables. Any ideas on how i can make ONE column with the sales of each person=?

 

Thank you and looking forward. 

 

piyushj
Frequent Visitor

You can also use new tabular table custom visual.
v-ljerr-msft
Employee
Employee

Hi @generaluser,

 

Have you tried the solution provided above? It should work in your scenario. If you still have any question on this issue, feel free to post here.

 

In addition, if the solution works, could you accept it as solution to close this thread? Smiley Happy

 

Regards

Sean
Community Champion
Community Champion

In the Query Editor

1) select the Product Column

2) Transform tab - Unpivot Columns - Unpivot Other Columns

3) Rename the Attribute and Values columns - Month and Units

Hi Sean, I have a table with 126 columns, that I need to be able to split out 60 columns and have them then line up based on the GUID.  They are the details that are attributed to each IR # that is entered based on a date and station ID. 

Such a useful function! 🙂


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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