Hi Ethan,
Sure thing, made a small change and added comments to explane that M code section here:
So here’s the full M statement again:
let
Source = Excel.Workbook(File.Contents(FileLocation), null, true),
#"Filtered Rows" = Table.SelectRows(Source, each ([Name] = "tUser")),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Data"}),
#"Expanded Data" = Table.ExpandTableColumn(#"Removed Other Columns", "Data", {"Name", "Region", "Country", "Email"}, {"Name", "Region", "Country", "Email"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Data",{{"Name", type text}, {"Region", type text}, {"Country", type text}, {"Email", type text}}),
BufferRegion = Table.Buffer(#"Region/County"),
Custom1 = Table.AddColumn(#"Changed Type", "Temp", each if [Country]="All" then
let currentLoopupID = [Region] in Table.SelectRows(BufferRegion, each [Region] = currentLoopupID)
else
let currentLoopupID = [Region] &"--"& [Country] in Table.SelectRows(BufferRegion, each [RC Permission] = currentLoopupID)),
#"Expanded Temp" = Table.ExpandTableColumn(Custom1, "Temp", {"RC Permission"}, {"RC Permission"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Temp",{{"RC Permission", type text}})
in
#"Changed Type1"
Changes to the Region table will require you to modify the M statement but now you know what each element does I’m sure that won’t be a problem.