Skip to content

Instantly share code, notes, and snippets.

@bjulius
Created January 10, 2023 23:18
Show Gist options
  • Save bjulius/9105b615f06cc2020065c09523f39f55 to your computer and use it in GitHub Desktop.
Save bjulius/9105b615f06cc2020065c09523f39f55 to your computer and use it in GitHub Desktop.
Custom M Function to Create Metadata Summary for Selected Table
(#"Select Table to Create Metadata Summary" as table) =>
let
Schema = Table.SelectColumns(
Table.Schema(#"Select Table to Create Metadata Summary"),
{"Name", "Position", "TypeName", "Kind", "IsNullable"}
),
Profile = Table.Profile(#"Select Table to Create Metadata Summary"),
Join = Table.Sort(Table.Join(Schema, "Name", Profile, "Column"), {"Position", Order.Ascending}),
ReType = Table.TransformColumnTypes(
Join,
{
{"Position", Int64.Type},
{"Count", Int64.Type},
{"NullCount", Int64.Type},
{"DistinctCount", Int64.Type}
}
),
Remove = Table.RemoveColumns(ReType, {"Column"})
in
Remove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment