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

Win a FREE 3 Day Ticket to FabCon Vienna. Apply 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
Memorable Member
Memorable Member

@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
Memorable Member
Memorable Member

@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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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