Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hi,
I am slowly trying to build my first function. I am starting without the parameters and will add them later.
I have the below code and basically i want to run the add column for each column provided in the SplitList (two rows in this case).
let
Source = OData.Feed("https://XXXX.crm.dynamics.com/api/data/v9.1/contacts?$select=contactid,statecode,statuscode", null, [Implementation="2.0", IncludeAnnotations="OData.Community.Display.V1.FormattedValue"]),
SplitList = Text.Split("statuscode,statecode",","),
#"Converted to Table" = Table.FromList(SplitList, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Added Custom" = Table.AddColumn(Source, "statuscode_meta", each Value.Metadata( each Text.From(#"Converted to Table"))[OData.Community.Display.V1.FormattedValue]?)
in
#"Added Custom"
Now if i change the custom col to this it works. So how do i feel the list of columns into this? Also how do i change the custom so that it is also changing per Splitlist (pref with _Name added at the end).
#"Added Custom" = Table.AddColumn(Source, "Custom", each Value.Metadata([statuscode])[OData.Community.Display.V1.FormattedValue]?)
Many thanks
Dan
Hi @Danfountain ,
About creating loop columns, you can refer:
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the links.
I am struggling to see how to implement this within my code. Any suggestions?
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 16 | |
| 14 | |
| 9 | |
| 8 | |
| 7 |