Last active
November 18, 2019 20:55
-
-
Save ImkeF/b990a56ee5f2eadddb145324a9224a84 to your computer and use it in GitHub Desktop.
M functions
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 func = | |
(TableWithCode as table, CodeColumnName as text) => | |
let | |
Source= TableWithCode, | |
EvaluateFunction = Table.AddColumn(Source, "Value", each Expression.Evaluate(Record.Field(_, CodeColumnName), #shared)), | |
Cleanup = Table.RemoveColumns(EvaluateFunction,{CodeColumnName}), | |
ToRecord = Record.FromTable(Cleanup) | |
in | |
ToRecord | |
, documentation = [ | |
Documentation.Name = " fnRecord.ToFunctionRecord | |
", Documentation.Description = " Converts a table with function code to a record where the function is active | |
", Documentation.Category = " Table | |
", Documentation.Author = " Imke Feldmann: www.TheBIccountant.com | |
", Documentation.Examples = {[Description = " | |
" , Code = " Check this blogpost explaining how it works: http://wp.me/p6lgsG-Gx | |
", Result = " | |
"]}] | |
in | |
Value.ReplaceType(func, Value.ReplaceMetadata(Value.Type(func), documentation)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment