Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Converting State Abbreviations

Hey guys, 

 

I have a column that looks like this:

 

State

AL

Alabama

TN

Tennessee

AL

AL

VA 

VA

Alabama

Virgina

Tennessee

 

How do I create one column that has the full name for every state?

  • Anonymous

     

    Import the data from http://www.stateabbreviations.us/ via Web 

     

    & go Edit Queries  use > Home Tab > Merge Queries  

     

     

        #"Added Conditional Column" = Table.AddColumn(#"Duplicated Column", "State", each if [state old] <> [#"state new"] then [#"State New"] else null )

     

    Regards,

    Chetan K

     

4 Replies

    • malagari's avatar
      malagari
      Icon for Continued Contributor rankContinued Contributor

      As trebgatte mentioned, you'll need to have some master lookup table for the states abbreviation and full name.  Then you can create a new calculated column that checks the length, and pulls the [StateFullName], otherwise it defaults to the existing value.

      • Anonymous's avatar
        Anonymous
        Not applicable

        New to Power BI & Data:  Can you provide the formula you would use to calculate length and pull state name.  Once I see it I can make the connection to how it works.

  • chethan's avatar
    chethan
    Icon for Resolver III rankResolver III

    Anonymous

     

    Import the data from http://www.stateabbreviations.us/ via Web 

     

    & go Edit Queries  use > Home Tab > Merge Queries  

     

     

        #"Added Conditional Column" = Table.AddColumn(#"Duplicated Column", "State", each if [state old] <> [#"state new"] then [#"State New"] else null )

     

    Regards,

    Chetan K