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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Mixed Data for States Column

Hey Power BI Team! 

 

I have mixed date for a state column that has both the state abbreviations and the state name. Is there a way to make it so they are all the state Abbreviations? 

 

EX: TX, Texas, CA, California

 

Thanks! 

9 REPLIES 9
HotChilli
Super User
Super User

Ok, so your original question is more

"I have state names for some rows and state abbreviations for other rows, in the same column.  I want to replace the state names with the correct abbreviations".

If so, you will need to get yourself a table with state names and abbreviations (a master table).  This could be from a spreadsheet or from a webpage - there will be lots around. Import that table.

You then need to do a merge with the existing table and the new 'States' table. This will be a left join on the 'ship to state' column and the statename column in the 'States' table.  You can then return the state abbreviation in a column. 

Some of them wil be null because the existing column has abbreviations already, or spelling errors or different variations of the name won't bring a match back.  You can tidy up the data at this stage to make matches more likely.

At that point you can add a column that says 'if returned column is null then original column else returned column'

--

So, quite a lot there for people who are new to Power Query but all very possible.  I think the powerbi documentation has a similar example (from memory).  I'll check and post the link. 

Worked beautifully.  Thank you for the instructions!

HotChilli
Super User
Super User

@Anonymous suggest you split column on delimiter (,). You can do this in Power Query by right-clicking the column header and choosing that option.

Anonymous
Not applicable

So my data is coming from Dynamics 365 and it is not seperated by , but i did find that i can do a replace item for each. 

Could there be another option @HotChilli ?

LaurenS22_0-1647523960500.png

 

HotChilli
Super User
Super User

Hello @Anonymous ,

 

Is that a 'yes' on my question?

Anonymous
Not applicable

yes. sorry @HotChilli i didn't read your question correctly. (not enought coffe in the system yet)

 

Anonymous
Not applicable

Good Morning @HotChilli ! 

 

Unfortunatley, the data is both state name and state abbreviation. I want to make it so that they are all state abbreviation. 

HotChilli
Super User
Super User

Are all the fields in  abbreviation, StateName   format and you want to return only the abbreviation i.e. the portion to the left of the comma?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors