Created
January 28, 2024 13:34
-
-
Save cbaragao/db1a94ffda8db02c87da58a5fb92a998 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
| let fnCreateMultiDimID = | |
| (fact as table, dim as table) => | |
| let | |
| // Get column names minus the first column on the dim table, which should be the id | |
| Columns = List.Skip(Table.ColumnNames(dim),1), | |
| // Join the tables | |
| Join = Table.Join(fact, Columns, dim, Columns), | |
| // Remove the columns in the fact table that are now stored in the dim table and keep the id | |
| Remove = Table.RemoveColumns(Join, Columns) | |
| in | |
| Remove, | |
| // Documentation | |
| fnType = type function (fact as table, dim as table) as table | |
| meta [ | |
| Documentation.Name = "fnCreateMultiDimID", | |
| Documentation.LongDescription = "This function takes a fact and dim table and brings over the dim id and removes columns in the fact table." | |
| ] | |
| in | |
| Value.ReplaceType(fnCreateMultiDimID, fnType) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment