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

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

Reply
joxe
Regular Visitor

How to pivot and display multiple values

Hello,

I can't solve a problem that seems too easy. If someone could help me. We have a program that gives us this type of list:

 

joxe_0-1636051006250.png

 

We need to put it this way, but I can't find a way to transform it with Query:

 

joxe_1-1636051045763.png

 

The problem is that when I pivot the first column of the original table, Query only shows me one value per row or it gives me an error. It could also be this other way, but I can't get it either:

joxe_2-1636051076546.png

 

I would appreciate your help. Thank you.

 

 

 

 

1 ACCEPTED SOLUTION
ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
I am always up for improved solutions, but in this case I'm wondering why.
My pivot solution isn't only faster to implement but will also run faster when executed. Or am I missing something here?:PBI_PivotAndDisplayMulitpleValues.gif

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

hi there, in my case, it is a little different, how can i do this? 

hellodazza_0-1740728536529.png

Because after pivoting, it is showing me this: 

hellodazza_1-1740728587905.png

i want to maintain all the values as it is. and then clean it up somemore. thanks. appreciate any help. thanks.



Anonymous
Not applicable

I put this gif together to walk you through the steps to get to this result.  I started with a group by. I knew tables could be converted to lists and then concatenated but couldn't remember how so I found some good info here (See reply by Marc Pincince ) to parse the grouped names into a concatenated list.  From there it was a series of pivot/unpivots and cleanup.

shiftresults.png

 

shiftschedulepivot.gif

ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
I am always up for improved solutions, but in this case I'm wondering why.
My pivot solution isn't only faster to implement but will also run faster when executed. Or am I missing something here?:PBI_PivotAndDisplayMulitpleValues.gif

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

joxe
Regular Visitor

I am very grateful to everyone for your solutions. I have used ImkeF's because it seemed the easiest to implement, and it has been great for me. Many thanks.

Anonymous
Not applicable

Wasn't trying to say your solution isn't better.  There is usually more than one way, I just shared the way I came up with.  If yours is faster and better then the @joxe should go with it. Doesn't hurt my feelings

HotChilli
Super User
Super User

Does this have to be in Power Query. The original format is very good for storage and further analysis.

If you keep it this way, create a matrix with Hour and Day then write a measure like:

MeasureW = CONCATENATEX(theTable, theTable[Name], ",")

it should work

 

ImkeF
Community Champion
Community Champion

Hi @joxe ,

pivoting is still the way to go, but you have to adjust the aggregation function for the values:

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8s3PS0msVNJRMrC0MjAA0r6JRZVKsTpYZLzyM/LAMiGlqcUQKUMDiJRjHlAmFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Day = _t, Hour = _t, Name = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Day", type text}, {"Hour", type time}, {"Name", type text}}),
#"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Day]), "Day", "Name", each Text.Combine(_, "#(lf)"))
in
#"Pivoted Column"

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

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 Kudoed Authors