Skip to content

Instantly share code, notes, and snippets.

@lcorbasson
Created January 31, 2025 22:01
Show Gist options
  • Select an option

  • Save lcorbasson/d4b075d823667d4421f97cb2fce834c1 to your computer and use it in GitHub Desktop.

Select an option

Save lcorbasson/d4b075d823667d4421f97cb2fce834c1 to your computer and use it in GitHub Desktop.
let
transformDotDollarDateColumns = (source_table as table) as table =>
let
dotDollarDateColumnNames = List.Select(Table.ColumnNames(source_table), each Text.EndsWith(_, ".$date")),
dotDollarDateColumnTypes = List.Transform(dotDollarDateColumnNames, each {_, type nullable datetimezone}),
renamedDotDollarDateColumnNames = List.Transform(dotDollarDateColumnNames, each Text.BeforeDelimiter(_, ".$date", {0, RelativePosition.FromEnd})),
dotDollarDateColumnRenames = List.Zip({dotDollarDateColumnNames, renamedDotDollarDateColumnNames}),
transformedTable = Table.TransformColumnTypes(source_table, dotDollarDateColumnTypes),
// renameTargetsRemovedTable = Table.RemoveColumns(transformedTable, renamedDotDollarDateColumnNames, MissingField.Ignore),
renamedTable = Table.RenameColumns(transformedTable, dotDollarDateColumnRenames)
in
renamedTable
in
transformDotDollarDateColumns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment