Created
January 10, 2023 23:18
-
-
Save bjulius/9105b615f06cc2020065c09523f39f55 to your computer and use it in GitHub Desktop.
Custom M Function to Create Metadata Summary for Selected Table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(#"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