Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
KingTac017
New Member

Custom Column on a "Whole Number Field" to convert to a new text column

Hello all,


I ran into a new problem for myself, I'm a bit new to Power BI. I created a custom column in the past by taking a two letter abbrevaition in a column and creating a new column with the full name of a city.

Now I have new custom column I'm trying to create.  One of the columns I have is a "whole number" type, then I'm trying to create a custom column that will convert that number into a message that will be text.

Example: New custom column name is "Error Message"
if [error code_d] = "60012" then "The installation has timed out due to no user interaction".
else if [error code_d] = "60013 then "Source File not found."

else [error code_d]

You get the idea.  So the column name [error code_d] is currently a "whole number" type, but the new column that I created (Error Message) is only carrying over the numbers and not the message.  Do I  need to change the type of the [error code_d] to text first?  When I do that, I noticed it adds a decimal point.

Is there an easier way to get to what I need?

1 ACCEPTED SOLUTION
ray_aramburo
Super User
Super User

How are you creating the new column? You can use the standard Conditional Column UI to get those results. See: 

ray_aramburo_0-1722961925827.png

 





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
ray_aramburo
Super User
Super User

How are you creating the new column? You can use the standard Conditional Column UI to get those results. See: 

ray_aramburo_0-1722961925827.png

 





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





Hi, thanks for that.

I was just clicking "Custom Column" and writing some basic code. I quickly put something together to show you.

1.The "Return_Code_d" type is listed as "whole number"

2. New Column [Error Code] is type "Any Data Type" from what I read as it being labeled as "ABC 123"
Example:
PowerBICustomColumn.png

 

So when I went to take a snap shot of what I just did, it just started working. I swear I did the same thing from before and all it did was bring the return error codes number to the new column.  Maybe I did something wrong.

Having said that and it seems to be working at the moment. I am glad you took the time to show my "Conditional Columns".  I never new you could set the "data typs" that way.

Thank you both.

vanessafvg
Super User
Super User

what is the data type of the new column?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.