Qlik Community

Qlik GeoAnalytics Documents

Documents related to Qlik GeoAnalytics.

Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today

Mapping Postal codes


Mapping Postal codes

Mapping data based on postal code areas or center points is a common task. However postal codes is not a one global standard and there is lot of variation between countries in format and structure that makes the task challenging.

Also the availability of postal code areas varies, many countries are included in the Qlik Location database, but for others postal code areas need to be purchased separately.


Here's the high level workflow, the bulk is data preparation before rendering

1. Prepare the data
- Make the postal codes unique
- Pad with zeroes
- Some countries are special
- Check coverage
- Build overview layers when possible

This app will show how to map postal code areas for five European countries: France, Great Britain, Germany and Italy. The indata is not clean and contains errors like in most uses cases.

Prepare the data

Make the postal codes unique

When mapping postal codes for several countries the first step is to make the postal code unique. The easiest way to do this is to add country code prefixed with a comma after the postal code.

=Postal & ',' & CountryCode as zip

Pad with zeroes

In many cases Excel drops leading zeroes in numerical postal codes. I can see that when looking at the max and min lengths. Note that not all postal codes are numeric though and UK is special so we fix that later. Pad with leading zeroes for France, Germany and Italy like this:



Great Britain is special

The postcodes are alphanumeric, and are variable in length: ranging from six to eight characters (including a space) long. Each post code is divided into two parts separated by a single space. More info at Wikipedia. Here's the three levels comparable to 2,3 and 4 digit numeric postal codes:

Area: 1 or 2 letters
District: 1 or 2 digits or a digit followed by a letter
Sector: 1 digit
Can be parsed like this if the the space is in the right place:
=If(IsNum(Mid(zip,2,1)),Left(zip,1),Left(zip,2)) & ',' & cc // Area
=subfield(zip,' ',1) & ',' & cc // District
=subfield(zip,' ',1) & ' ' & left(subfield(zip,' ',2),1) & ',' & cc // Sector
Check coverage
By checking the table at Qlik GeoAnalytics Coverage I can tell that there is built support for postal code areas for most of the countries I am interested. However:
(1) Postal code areas are missing for Italy.
(2) France doesn't support 2,3,4 level postal code areas.
(3) Northern Ireland is not included in the areas for Great Britain.


Truncate for 2 and 3 digit postal code levels
Germany and Switzerland are easy, just truncate the zip code and add the country code. Add the following before the load:
load *,
left(zip,2) & ',' & cc as zip2,
left(zip,3) & ',' & cc as zip3;
France, IntersectsMost
For France we will use administrative areas level 1 and level 2 as replacement of the non-existing postal code areas of 2 and 3 digit.
Using the QGA connector operation IntersectMosts will construct the hierarchy between postal code and admin boundaries:  Adm1>Adm2>Zip. For details see the load script.


Italy, Within
For Italy we will also use admin 1 and 2, and use a point layer for the postal code level.
Using the QGA connector operation Within we can link postal code center points to the administrative boundary level 2: Adm1>Adm2>Zip. For details see the load script.


Create map view
After that it's easy to put together a map view.
1. Create a drill down group Country > zip2 > zip3 > zip
2. Add map chart and a area layer, drill down group as dimension, color by Sum(Sales)
3. Add a point layer only visible on level "zip", add a set expression for location: only({<cc={'IT'}>}zip)
See the attached app and data for more details.
Labels (2)
Contributor III
Contributor III

@Patric_Nordstrom thanks , this is helpful however I went through the data prep and still having a significant issue in that many of my US zip codes are showing up in seemingly random countries in Europe.  My Zips are padded to be 5 digits and country code is US. For example 49424,US




49424,US works for me:




Contributor II
Contributor II

Hi Patric,

Question regarding Italy. We use QlikSense Business, but the cloud version, not the desktop.
We have postal codes for UK, France, Spain, Germany and Italy. We are able to plot the postal areas to area maps nicely for every country but Italy.
Do you think Qlik is still not supporting the postal code area level for Italy? Alternatively it would be also good if we could use the "commune" level of Italy, that should be administration level 3 I beleive, but as far as I see admin. level 2 is the lowest I can go down in Italy.

Is this the case? Do you know any workaround in cloud?

Many thanks in adavance,



Not in any near future, meanwhile load the commune level of Italy using the techniques described above.

https://www.istat.it/ is good source of Italian boundary data.



Version history
Revision #:
1 of 1
Last update:
‎2019-05-30 04:28 PM
Updated by: