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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AspireCraig
New Member

Replacing an Integer value with Text using a DAX Formula

Hello everyone,

I am struggling with what seems like a simple task. I am new to Power Bi and using a directy query, my vaules are 1,2,3,4,5, etc. in a field called Types and I want to repalce the Ids with a friendly name, 1= Marketing, 2=PSA, etc. 

I Created a new colum and called it pNames. I have tried using the IF function with something like 

=IF(Query1[TYPES]="1", "MARKETING") on my pType field I receive "Model object names must be non-empty"


What function and syntax would I use for this?

2 REPLIES 2
Anonymous
Not applicable

Hi @AspireCraig ,

 

I tried working on your example but it works for me without any problem.

your IF formula is also correct. Dont know why you are getting this error. ( May be try to chnage the datatype because you replace)

 

or else you can try this 

In Query editor, you can select the column Types and right click-> replace values.

 

Just make sure your changing the datatype to text. ( since you are replacinmg the numerical values with a text values)

 

 

Also take a look at this post with similar error:

 

https://community.powerbi.com/t5/Desktop/Model-object-names-must-be-non-empty-error-message/td-p/460...

 

https://community.powerbi.com/t5/Desktop/quot-Model-Object-names-must-be-non-empty-quot-error-on-all...

 

Thanks,

Tejaswi

Hi @Tejaswi
Changing the type to text would be too easy, it appears this cannot be done when using a direct query importing will not work as this is live data.  From what I can tell all the records have a value set on them. There are no empty or null values on the 'Types' field.
Anything else to try?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.