Forum Discussion
Keep one in every x values in a column
Hi Anonymous ,
You need to create a new blank query in Power Query, then go to the Home tab > Advanced Editor. Once the code window is open, paste my code oer all the default code that's in there.
Pete
I am new with working with powerquery, can you help me how to implement your solution in my current query:
let
Source = SharePoint.Tables("XXXXX", [Implementation="2.0", ViewMode="All"]),
#"dca7bbdd-3e86-4c77-95c3-980301dd0d44" = Source{[Id="dca7bbdd-3e86-4c77-95c3-980301dd0d44"]}[Items],
#"Added Index" = Table.AddIndexColumn(#"dca7bbdd-3e86-4c77-95c3-980301dd0d44", "Index", 0, 0, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "Employee1", each [Employee]{[Index]}[title]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom", each [BillTo]{[Index]}[lookupValue]),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "weekstart_m", each Date.AddDays([Week Start],1)),
#"Added Custom3" = Table.AddColumn(#"Added Custom2", "Weekeind", each Date.AddDays([Week Start],7)),
#"Changed Type" = Table.TransformColumnTypes(#"Added Custom3",{{"weekstart_m", type date}, {"Weekeind", type date}}),
#"Added Custom4" = Table.AddColumn(#"Changed Type", "Dates", each { Number.From([weekstart_m])..Number.From([Weekeind]) }),
#"Expanded Dates" = Table.ExpandListColumn(#"Added Custom4", "Dates"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Dates",{{"Dates", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Mon", "mon"}, {"Tues", "tue"}, {"Weds", "wed"}, {"Thurs", "thu"}, {"Fri", "fri"}, {"Sat", "sat"}, {"Sun", "sun"}})
in
#"Renamed Columns"