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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
damit230183
Frequent Visitor

Conversion of Columns into Rows with Group by Function

Hi,

I have been working on one report where I need to conver columns into rows and make that rows as Header.

This is what I have:

 

damit230183_0-1752003996678.png

 

This is what the result should look like

damit230183_1-1752004228419.png

Any help or suggestion would appreciate it.

 

Thanks in Advance for your inputs.

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

Please try to use Table.Pivot M code.

Jihwan_Kim_0-1752005965804.png

 

Table.Pivot - PowerQuery M | Microsoft Learn

 

let
    Source = source,
    #"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[field1]), "field1", "field2")
in
    #"Pivoted Column"

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

MasonMA
Community Champion
Community Champion

@damit230183 

 

Hi, you can pivot the column through Power Query UI as well:

1. Select Field 1 column, under Transform click Pivot. 

MasonMA_1-1752006313935.png

2. In Pivot window, Select 'Field 2' for Value Column and 'Dont aggregate' for Aggregate Value Function. 

MasonMA_0-1752006263914.png

Hope this makes it simpler:) 

View solution in original post

3 REPLIES 3
damit230183
Frequent Visitor

 Thank you both for your response.

 

Both solution worked perfectily as expected.

 

Thanks

MasonMA
Community Champion
Community Champion

@damit230183 

 

Hi, you can pivot the column through Power Query UI as well:

1. Select Field 1 column, under Transform click Pivot. 

MasonMA_1-1752006313935.png

2. In Pivot window, Select 'Field 2' for Value Column and 'Dont aggregate' for Aggregate Value Function. 

MasonMA_0-1752006263914.png

Hope this makes it simpler:) 

Jihwan_Kim
Super User
Super User

Hi,

Please try to use Table.Pivot M code.

Jihwan_Kim_0-1752005965804.png

 

Table.Pivot - PowerQuery M | Microsoft Learn

 

let
    Source = source,
    #"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[field1]), "field1", "field2")
in
    #"Pivoted Column"

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors