Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Multiple IF Statements (50+)

Hello everyone,
i have a cloumn full of abbrevations, i need to create a new column with full name

 

(eg.

COUNTRY NAME = IF(Table1[Noc] = "FRA", "France",IF(Table1[Noc] = "GER", "Germany",....
The problem is there are more thn 100 countries.
What is the easiest way other than use if statements?

thank you in advance.

 

2 ACCEPTED SOLUTIONS
HotChilli
Community Champion
Community Champion

Put your data in a table and use a merge to match the short codes.  You can return the country full name after that.

View solution in original post

AlexisOlson
Super User
Super User

For that many, you almost certainly want to use a table as @HotChilli recommends.

 

I just wanted to mention the SWITCH function which is much cleaner than IF in these sorts of situations:

https://dax.guide/switch/

 

Country Name =
SWITCH (
    Table1[Noc],
    "FRA", "France",
    "GER", "Germany",
    "ITA", "Italy",
    "USA", "United States of America"
)

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

@AlexisOlson This is the one which i was looking for, thank you very much.

AlexisOlson
Super User
Super User

For that many, you almost certainly want to use a table as @HotChilli recommends.

 

I just wanted to mention the SWITCH function which is much cleaner than IF in these sorts of situations:

https://dax.guide/switch/

 

Country Name =
SWITCH (
    Table1[Noc],
    "FRA", "France",
    "GER", "Germany",
    "ITA", "Italy",
    "USA", "United States of America"
)
HotChilli
Community Champion
Community Champion

which part is causing you trouble?

Have you created the table?

col1 col2

FRA France

GER Germany

...

Anonymous
Not applicable

Thank you , finally i can do it, without using Merge, just created the table and make a relation with the other one and it works, thank you.

Anonymous
Not applicable

@HotChilli sorry i couldn't get it , can you show me a way to do that ? or anyway to make it with DAX

Anonymous
Not applicable

you could use a record as dictionary from short name to extenden name

 

let
    dict=[fra="france",ger="germany",ita="italy",usa="united states of america"],
    
    Origine = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSitKVNJRSspJVIrViVZKTy1C4mWWIMuVFsN5sQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Colonna1 = _t, Colonna2 = _t]),
    #"Modificato tipo" = Table.TransformColumnTypes(Origine,{{"Colonna1", type text}, {"Colonna2", type text}}),
    #"Aggiunta colonna personalizzata" = Table.AddColumn(#"Modificato tipo", "extended", each Record.Field(dict,[Colonna1]))
in
    #"Aggiunta colonna personalizzata"
HotChilli
Community Champion
Community Champion

Put your data in a table and use a merge to match the short codes.  You can return the country full name after that.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.