KNOWLEDGE BASE

Using Canadian Postal Codes


Published: 11 Apr 2017
Last Modified Date: 20 Nov 2017

Question

How to map Canadian postal codes.

Environment

Tableau Desktop

Answer

Tableau recognizes only the first three characters of the six-character Canadian postal code - the forward sortation area. If Canadian postal codes in your data are formatted with all six characters, you can create a calculation to map the postal codes. 

If all your postal codes are Canadian

The below instructions are based on the attached canadian_postal_codes.twbx
  1. Select Analysis > Create Calculated Field 
  2. Name the field Postal Code, enter the following formula, then click OK: 
    LEFT([Customer Postcode], 3)
  3. In Dimensions, right-click Postal Code and select Geographic Role > ZIP Code/Postcode. 
  4. Drag Postal Code to Detail. 
You will now see a mark for each three-character postal code in your data. 

If your data contains both US and Canadian postal codes 

The below instructions are based on the attached multiple_countries_postcodes.twbx. 
  1. Ensure that your data source has a column for country names. In this example, the field is called Country. 
  2. Select Analysis>Create Calculated Field 
  3. Name the field Postal Code, enter the following formula, then click OK:
    IF [Country] = "Canada"
    THEN LEFT ([Customer Postcode], 3)
    ELSE [Customer Postcode]
    END
  4. Drag Postal Code to Detail. 
  5. If not all postal codes appear and # unknown appears in the lower right hand corner of the viz, you might need to edit their locations. For more information, see Edit Locations
Did this article resolve the issue?