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
Adam1V
Frequent Visitor

Custom Column - Multiple If Statement

Hi,

Im extremly new to Power Bi so hoping this isnt a silly question.

 

Im looking to expand on employees initials within power bi and im trying to use a custom column to do so with the below formula, however im getting an 'Expression Error - The Name 'If' wasnt recogised". Can anyone advise where I may be going wrong?

 

 

 

 

IF([DESIGN ENGINEER]="PG","PAUL Gxxxx",IF([DESIGN ENGINEER]="AB","ASHLEY Bxxxx",IF([DESIGN ENGINEER]="SG","SAM Gxxxx",IF([DESIGN ENGINEER]="TB","TOM Bxxxx",IF([DESIGN ENGINEER]="NBJ","NATHAN Bxxxx",IF([DESIGN ENGINEER]="LB","LLOYD Bxxxx",IF([DESIGN ENGINEER]="DW","DAVE Wxxxx",IF([DESIGN ENGINEER]="AMV","ADAM Vxxxx",IF([DESIGN ENGINEER]="DB","DAVID Bxxxx","")))))))))

 

 

 

2 ACCEPTED SOLUTIONS
Adam1V
Frequent Visitor

Actually just managed to resolve this, below for anyone else searching for this in the future;

 

if [DESIGN ENGINEER] = "PG" then "PAUL Gxxxxx" else if [DESIGN ENGINEER] = "AB" then "ASHLEY Bxxxxx" else if [DESIGN ENGINEER] = "SG" then "SAM Gxxxxx" else if [DESIGN ENGINEER] = "TB" then "TOM Bxxxx" else if [DESIGN ENGINEER] = "NBJ" then "NATHAN Bxxxx" else if [DESIGN ENGINEER] = "LB" then "LLOYD Bxxxx" else if [DESIGN ENGINEER] = "DW" then "DAVE Wxxxx" else if [DESIGN ENGINEER] = "AMV" then "ADAM Vxxxx" else if [DESIGN ENGINEER] = "DB" then "DAVID Bxxxx" else ""

View solution in original post

Anonymous
Not applicable

Is this in the query editor? It looks like DAX syntax but that error sounds like the query editor, which uses a different language. If statements there have a completely different syntax.  In the query editor an if statement looks like this (case sensitive)

if [DESIGN ENGINEER]="PG" then "PAUL Gxxxx"
	else if [DESIGN ENGINEER]="AB" then "ASHLEY Bxxxx"
	else if [DESIGN ENGINEER]="SG" then "SAM Gxxxx"
	...
	else ""

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Is this in the query editor? It looks like DAX syntax but that error sounds like the query editor, which uses a different language. If statements there have a completely different syntax.  In the query editor an if statement looks like this (case sensitive)

if [DESIGN ENGINEER]="PG" then "PAUL Gxxxx"
	else if [DESIGN ENGINEER]="AB" then "ASHLEY Bxxxx"
	else if [DESIGN ENGINEER]="SG" then "SAM Gxxxx"
	...
	else ""
smpa01
Community Champion
Community Champion

@Adam1V  i am guessing that you are doing it in M. The correct syntax would be

if [DESIGN ENGINEER]="PG" then "A" else if [DESIGN ENGINEER]="AB" then "B" else if[DESIGN ENGINEER]="SG" then "C" else -800

========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================
Adam1V
Frequent Visitor

Actually just managed to resolve this, below for anyone else searching for this in the future;

 

if [DESIGN ENGINEER] = "PG" then "PAUL Gxxxxx" else if [DESIGN ENGINEER] = "AB" then "ASHLEY Bxxxxx" else if [DESIGN ENGINEER] = "SG" then "SAM Gxxxxx" else if [DESIGN ENGINEER] = "TB" then "TOM Bxxxx" else if [DESIGN ENGINEER] = "NBJ" then "NATHAN Bxxxx" else if [DESIGN ENGINEER] = "LB" then "LLOYD Bxxxx" else if [DESIGN ENGINEER] = "DW" then "DAVE Wxxxx" else if [DESIGN ENGINEER] = "AMV" then "ADAM Vxxxx" else if [DESIGN ENGINEER] = "DB" then "DAVID Bxxxx" else ""

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 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.

Top Solution Authors