Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi,
I have a custom function (see below a fraction of it). What I am supposed to insert in that function in order it adds a custom column to a table in which this function is invoked?
Till now, I've been getting errors such as :cannot convert value into table:
Thank you in advance for any help
if numberOfSlashes=2
then
Table.AddColumn(WHAT TO INSERT HERE?,
"firstDirectory", "2" ......)
Hi PetrR,
Follow this pattern:
Table.AddColumn(table as table, newColumnName as text, columnGenerator as function, optional columnType as nullable type) as table
Regards,
Jimmy Tao
Hi Jimmy,
thanks for your help.
I have this code (see below)
So I am supposed to set the first parameter in Table.AddColumn function as parameter?
For example, I run this function within a table "gsc-data". If I set the parameter table to gsc-data, the Power Query reponses
An error occurred in the ‘Query1’ query. Expression.Error: We cannot convert the value "gsc-data" to type Table.
Details:
Value=gsc-data
Type=Type
Next time, the table from whichh the function is runned might be "analytics data". So I think the table name should be a parameter, but do not how to make it work...
let
structureURL = (url,table)=> let
#"urlWithoutProtocol" =
if Text.Contains(url,"https://") = true then Text.Replace (url,"https://","")
else if Text.Contains(url,"http://") = true then Text.Replace (url,"http://","")
else url,
#"urlWithoutEndingSlash" = if Text.End(urlWithoutProtocol,1)="/" then Text.Start(urlWithoutProtocol,Text.Length(urlWithoutProtocol)-1)
else urlWithoutProtocol,
#"numberOfSlashes" = Text.Length(urlWithoutEndingSlash)-Text.Length(Text.Replace(urlWithoutEndingSlash,"/","")),
#"firstDirectory"= if numberOfSlashes=1 then Text.Middle(urlWithoutEndingSlash,Text.PositionOf(urlWithoutEndingSlash,"/"),100)
else
if numberOfSlashes=2
then
Table.AddColumn(table as table, "firstDirectory", "2") as table
else ""
in #"firstDirectory"
in #"structureURL"
Thanks
RP
Hi PetrR,
Is "gsc-data" an exist table or the name of table you want to create? Could you share a screenshot of tables you have?
Regards,
Jimmy Tao
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
85 | |
83 | |
66 | |
60 | |
58 |
User | Count |
---|---|
194 | |
111 | |
105 | |
79 | |
71 |