Created
January 26, 2024 18:51
-
-
Save cbaragao/3ebb5ffc36240396f1465ebfeae5e59f to your computer and use it in GitHub Desktop.
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
| (tbl as table, col_name as text, index_name as text)=> | |
| let | |
| removed_cols = Table.SelectColumns(tbl,{col_name}), | |
| dedupe = Table.Distinct(removed_cols), | |
| sorted = Table.Sort(dedupe,{{col_name, Order.Ascending}}), | |
| add_index = Table.AddIndexColumn(sorted, index_name, 1, 1, Int64.Type), | |
| order = Table.ReorderColumns(add_index,{index_name, col_name}) | |
| in | |
| order |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment