Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I am trying to add metadata when calling AddColumn function.
The new column is a function type and its body will be empty (just a reference). It works fine with this command:
FunctionColumnAddedTable = Table.AddColumn(Source, "FunctionColumn", each (InputColumn1 as text) as any => ...)
I want to add meta to this function such as:
FunctionColumnAddedTable = Table.AddColumn(Source, "FunctionColumn", each (InputColumn1 as text) as any => ... meta [Description = "Desc"])
But when I try to get the metada, I see it is empty:
MetadataColumn = Table.AddColumn(FunctionColumnAddedTable , "MetadataColumn", each Value.Metadata([FunctionColumn]))
Any idea about my mistake?
Solved! Go to Solution.
Hi @ImkeF ,
"That's metadata in the result of a function." helped me to try enclosing the function definition between paranthesis to add metadata to the function body. And it worked by doing:
FunctionColumnAddedTable = Table.AddColumn(Source, "FunctionColumn", each ((InputColumn1 as text) as any => ...) meta [Description = "Desc"])
Thank you very much for your help
Hi @necmik ,
this is what that query returns for me:
But now I see what you are after. That's metadata in the result of a function.
It would work like so:
() =>
Table.FromRecords(
{
[noMetadataHere = 1,
WithMetadataOfTheInvokedFunction = 2 meta [InvokedMetadata = "Some metadata here"]
]
}
)
Please also check the file enclosed.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @ImkeF ,
"That's metadata in the result of a function." helped me to try enclosing the function definition between paranthesis to add metadata to the function body. And it worked by doing:
FunctionColumnAddedTable = Table.AddColumn(Source, "FunctionColumn", each ((InputColumn1 as text) as any => ...) meta [Description = "Desc"])
Thank you very much for your help
Hi @necmik ,
not sure I fully get it, but you might have created a nested function. Try omitting the each syntax sugar like so:
FunctionColumnAddedTable = Table.AddColumn(Source, "FunctionColumn", (InputColumn1 as text) as any => ... meta [Description = "Desc"])
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @ImkeF ,
Thank you for your answer. I have already tried it but it didn't work. What I am trying to do is creating a function similar to AIFunctions.Contents(). Its data column basically includes a function reference and metadata related to the this reference. You can check it by runing M query below. You can see that some functions have metadata (such as Cognitive Services ones):
let
MetadataColumn = Table.AddColumn(AIFunctions.Contents(), "MetadataColumn", each Value.Metadata([Data]))
in
MetadataColumn