Forum

Handling multi-valu...
 
Notifications
Clear all

Handling multi-value cells

7 Posts
3 Users
0 Reactions
175 Views
(@grawri)
Posts: 10
Active Member
Topic starter
 

I'm sure this is a simple query but I'm struggling.
I want to convert simple sales data that has 1 row for each Date but several products and Amounts in the adjacent cells.MVCells.png
Please find attached file if you want to have a crack.

[Image Can Not Be Found]

 
Posted : 08/08/2023 1:24 am
(@grawri)
Posts: 10
Active Member
Topic starter
 

File

 
Posted : 08/08/2023 1:28 am
Riny van Eekelen
(@riny)
Posts: 1185
Member Moderator
 

The attached file contains a rather clunky (but working) solution I made up myself. It requires a certain amount of M-code manipulation but it's not too advanced.

Now you can do all this with more advanced techniques like custom functions and List.Generate. Search on-line for 'split multiple columns into rows power query'. You may find similar or even clunkier ones than mine.

 
Posted : 08/08/2023 5:40 am
(@debaser)
Posts: 836
Member Moderator
 

Just as an alternative, you can split the two columns into lists and make a table out of them, then expand that table - see attached sample.

 
Posted : 12/08/2023 3:58 am
Riny van Eekelen
(@riny)
Posts: 1185
Member Moderator
 

Nice! @Velouria

 
Posted : 12/08/2023 5:00 am
(@debaser)
Posts: 836
Member Moderator
 

Thanks, though I can't claim credit. (unfortunately I've forgotten where I first came across that trick or I'd give proper attribution)

 
Posted : 12/08/2023 6:57 am
(@grawri)
Posts: 10
Active Member
Topic starter
 

Thanks heaps for both responses.
Velouria's is nice.  And simple.  Just how I like it.
That's not to take away from Riny's Clunker.  That was also helpful and introduced me to some concepts I hadn't considered before.

Thank you both.

 
Posted : 16/08/2023 7:57 pm
Share: