Power query - How to convert Categories to a column

grawri

New Member
Joined
Aug 19, 2017
Messages
2
What Power query formula would i need to convert the Shop ID that appears in my Ref column into it's own column as per the second data sample?


Ref Rep Date Amount
101 Melbourne
JKL0345 PJ 1/07/2017 453.98
HLK0462 KL 1/07/2017 364.78
IDE876 PJ 1/07/2017 234.85
POL234 KL 1/07/2017 129.73
125 Collingwood
TYB003 VG 1/07/2017 876.34
RFI879 DC 1/07/2017 465.43
EDW553 DC 1/07/2017 198.23
PIJ556 WS 1/07/2017 223.45


Ref Rep Date Amount Shop ID
JKL0345 PJ 1/07/2017 453.98 101
HLK0462 KL 1/07/2017 364.78 101
IDE876 PJ 1/07/2017 234.85 101
POL234 KL 1/07/2017 129.73 101
TYB003 VG 1/07/2017 876.34 125
RFI879 DC 1/07/2017 465.43 125
EDW553 DC 1/07/2017 198.23 125
PIJ556 WS 1/07/2017 223.45 125
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Book1
ABCDE
28RefRepDateAmount
29101Melbourne101
30JKL0345PJ1-7-2017453,98101
31HLK0462KL1-7-2017364,78101
32IDE876PJ1-7-2017234,85101
33POL234KL1-7-2017129,73101
34125Collingwood125
35TYB003VG1-7-2017876,34125
36RFI879DC1-7-2017465,43125
37EDW553DC1-7-2017198,23125
38PIJ556WS1-7-2017223,45125
Blad2
Cell Formulas
RangeFormula
E29=IF($D29="",$A29,$E28)
 
Last edited:
Upvote 0
In Power Query:

Code:
let
    Source = Table1,
    #"Added Custom" = Table.AddColumn(Source, "Shop Id", each if [Date] = null then [Ref] else null),
    #"Filled Down" = Table.FillDown(#"Added Custom",{"Shop Id"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each [Date] <> null and [Date] <> "")
in
    #"Filtered Rows"
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,412
Members
448,960
Latest member
AKSMITH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top