Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
Check out the July 2025 Power BI update to learn about new features.