cancel
Showing results for 
Search instead for 
Did you mean: 
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_
Solution Sage
Solution Sage

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_
Solution Sage
Solution Sage

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
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors