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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
Which function should I use to convert text to number in a new column? I want to convert these:-
Chocolate = 1
Candy = 2
Bottled Water = 3
Beer = 4
Thanks!
Solved! Go to Solution.
Hi, @925stuart I hope you've got the idea.
let
Source = #table({"product"}, {{"Chocolate"}, {"Candy"}, {"Bottled Water"}, {"Beer"}}),
rec = [Chocolate = 1, Candy = 2, Bottled Water = 3, Beer = 4],
new_column = Table.AddColumn(Source, "new_column", each Record.FieldOrDefault(rec, [product]))
in
new_column
Cool! That was what I needed to get started! Found the doc!
Hi, @925stuart I hope you've got the idea.
let
Source = #table({"product"}, {{"Chocolate"}, {"Candy"}, {"Bottled Water"}, {"Beer"}}),
rec = [Chocolate = 1, Candy = 2, Bottled Water = 3, Beer = 4],
new_column = Table.AddColumn(Source, "new_column", each Record.FieldOrDefault(rec, [product]))
in
new_column