Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I'm trying to improve M Language readability and reduce code by returning a text data type as opposed to returning a number and then converting it to text.
So far, I've tried using the Number.ToText method without luck. I've tried returning the number with double quotes around, i.e
if [Freq] = 12 then "3". Once you look at the column, however, the data type says "Any" as opposed to "Text". When you Close and Load the data to the workbook, the data type is "General" as opposed to Text.
Anyway I can return Text to avoid having to do so in a separate step?
Solved! Go to Solution.
@Anonymous specifying "type text" at the end worked for me.
= Table.AddColumn(#"Changed Type", "Custom", each if [Type] = 3 then 2 else if [Type] = 12 then 3 else if [Type] = 24 then 2 else if [Type] = 26 then 8 else if [Type] = 52 then "1" else "", type text)
@Anonymous specifying "type text" at the end worked for me.
= Table.AddColumn(#"Changed Type", "Custom", each if [Type] = 3 then 2 else if [Type] = 12 then 3 else if [Type] = 24 then 2 else if [Type] = 26 then 8 else if [Type] = 52 then "1" else "", type text)