Reverse of Fill Down in PQ

sadath

Active Member
Joined
Oct 10, 2004
Messages
267
Office Version
  1. 365
Platform
  1. Windows
Hi

How can i do the reverse of Fill Down in PQ.

ie remove the duplicate and keep only the first one in a column (Eg "Store" in the below code)


let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Store", type text}, {"Sales", Int64.Type}})
in
#"Changed Type"
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Using your posted example as the start of my Power Query code....
Here's what I did:
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    SetDataTypes = Table.TransformColumnTypes(Source,{{"Store", type text}, {"Sales", Int64.Type}}),
    AddedIndex = Table.AddIndexColumn(SetDataTypes, "Index", 0, 1),
    GroupByName = Table.Group(AddedIndex, {"Store"}, {{"Group", each _, type table}}),
    AddGroupIndex = Table.TransformColumns(GroupByName, {{"Group", each Table.AddIndexColumn(Table.Sort(_,"Index"), "GroupIndex",1), type table}}),
    ExpandedGroup = Table.ExpandTableColumn(AddGroupIndex, "Group", {"Sales", "Index", "GroupIndex"}, {"Sales", "Index", "GroupIndex"}),
    SetNonFirstGroupRecordToNull = Table.FromRecords(Table.TransformRows(ExpandedGroup,(record) => Record.TransformFields(record,{"Store", 
        each if record[GroupIndex] =  1 then _ else null})))
in
    SetNonFirstGroupRecordToNull
Am I on the right track?
Is that something you can work with?
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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