Forum Discussion

Krish_76's avatar
Krish_76
Frequent Visitor
9 years ago
Solved

Leading Zero Issue

Hello everyone

 

I am having trouble with the Zip codes when it has 0 as the leading.

 

Example :

I have data like this in excel 

NJ   07306

TN  38120

 

When i imported into Power BI, it is importing in this format

NJ    7306

TN    38120

 

I went in to query editor and tried to change the format as TEXT but it didn't help me. If there was only handful then i would have replaced it but there are so many of them and i am not sure how to replace them.

 

Can anyone please help me on this. Because right now the map is showing all over the world (Instead of just US) when i place the Zip codes.

  • Anonymous's avatar
    Anonymous
    9 years ago

    Quick solution is to create a new custom column in DAX with a formula:

    FullZip = FORMAT([Zip], "00000")

    Where [Zip] is your zip code field name.

11 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Quick solution is to create a new custom column in DAX with a formula:

    FullZip = FORMAT([Zip], "00000")

    Where [Zip] is your zip code field name.

    • d-mo's avatar
      d-mo
      Regular Visitor

      I am getting an Expression.Error: The name 'FORMAT' wasn't recognixed. Make sure it's spelled correctly.

      • ACT's avatar
        ACT
        Frequent Visitor

        I am too...I tried to write it within the Advanced Query Editor rather than creating a new column as well...tried to edit format changes, etc. Can't seem to get it to work. =(

    • ACT's avatar
      ACT
      Frequent Visitor

      Thank you nchambe! Sorry I forgot to update...it turned out that the issue was in SQL Server, not Power BI.