Hello,
I use PQ a lot but am fairly new to it. I work with large data sets of sales data, this particular one contains a column of zip codes. These are usually normal 5-digit zips, but sometimes they can be a full 9 digit with a dash like 75149-1234. When this happens, it causes an error in PQ.
Even if I change the data type to Text for those columns, the error happens.
Apart from just fixing the zip codes in the source data which is what I currently do, is there some proper way to deal with this?
Thanks in advance
Zip Codes with Dashes in PowerQuery (troubles)
-
- NewLounger
- Posts: 1
- Joined: 27 Feb 2023, 07:53
-
- Administrator
- Posts: 78657
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Zip Codes with Dashes in PowerQuery (troubles)
Welcome to Eileen's Lounge.
In a quick test, I cannot reproduce the error.
Could you attach a small sample file that demonstrates the problem? You only need to include some zip codes.
In a quick test, I cannot reproduce the error.
Could you attach a small sample file that demonstrates the problem? You only need to include some zip codes.
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 58
- Joined: 10 Mar 2021, 22:57
Re: Zip Codes with Dashes in PowerQuery (troubles)
- change type in column with zips to text
- use Text.Start([zips], 5) to make all zips length 5 characters
zip is not a number for any calculation so text is the best option
- use Text.Start([zips], 5) to make all zips length 5 characters
zip is not a number for any calculation so text is the best option