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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
leletran
Frequent Visitor

Formatting non-US zip codes

Hello,

 

Hope all is well! My apology if this was answered elsewhere. I searched the forum and google'd but was not able to find relevant results. I'm working on a shipment dashboard and we send shipments locally and internationally. Thus, we have zip codes that contain both letters and characters. I'm wondering if there's a way to handle formatting US zip as "00000-0000" (or "00000") while leaving the non-US zip unaffected?

 

My original plan was to create two dashboards - one for US, and one for international, but I figured I'd ask here. Any insight is greatly appreciated! Many thanks in advance for the time and help! 

 

Shipments_ZipCodes.png

 

Cheers,

Lele

 

 

1 ACCEPTED SOLUTION
vicky_
Super User
Super User

You could try add a calculated column: 
Formatted ZipCode = IF([CountryColumn] = "United States", format your zip code, [zip code])
As for how to format the US zip codes, you will probably need to use the RIGHT() or LEFT() functions to grab the right bits before and after the hyphen.

View solution in original post

2 REPLIES 2
vicky_
Super User
Super User

You could try add a calculated column: 
Formatted ZipCode = IF([CountryColumn] = "United States", format your zip code, [zip code])
As for how to format the US zip codes, you will probably need to use the RIGHT() or LEFT() functions to grab the right bits before and after the hyphen.

Hi Vicky,

 

Good morning! That worked - you are a genuis! Thank you so much for your time and help! 😁 

 

The formula: Formatted ZipCode = IF([RecipientCountry] = "United States", CONCATENATE(LEFT([Zip Code],5), CONCATENATE("-", RIGHT([Zip Code],4))), [Zip Code])

 

Screenshot 2023-03-29 at 9.23.53 AM.png

 

I hope this helps anyone that want to format US- and non-US zip! Thank you again, Vicky. Have a great rest of your morning and day!

 

Cheers,

Lele

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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