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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

IF and SWITCH Functions

Hello,

 

IF and SWITCH have their own set of rules?

 

IF-

Tried using the IF function, its doesnt allow to use it more than 3 times?

Error-"Too many arguments were passed to the IF function. The maximum argument count for the function is 3."

 
Column = if(Sheet1[Month]="Jan","Fisrt",
                 IF(Sheet1[Month]="feb",
                 IF(Sheet1[Num]=2,"Second","Good",
                 IF(Sheet1[Month]="Mar","Third"))))

SWITCH-
Error- Function 'SWITCH' does not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

Work type ref 1 = SWITCH(Sheet1[Project Portfolio Name]="none",
                                           Sheet1[Project ID]="XX1001","Vacation",
                                           Sheet1[Project ID]="XX1002","Vacation",
                                           Sheet1[Project ID]="XX1003","Vacation",
                                           Sheet1[Project ID]="XX1004","Vacation",
                                           Sheet1[Project ID]="XX1005","Vacation",
                                           Sheet1[Project ID]="XX1006","Vacation","Non- Proj",
                                           Sheet1[Project Portfolio Name]="Run the Business (RTB)","RTB")

 

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

Column = if(Sheet1[Month]="Jan","Fisrt",
IF(Sheet1[Month]="feb",what's the result for feb?
IF(Sheet1[Num]=2,"Second","Good",//this IF staement is completed, you can't have the below statments
IF(Sheet1[Month]="Mar","Third"))))

please make sure if statment has three parameters (condition, true, false)

 

SWITCH

What's the higher priority column of this? you can't put two columns in the switch. please share the sample data and explain the logic.

 

Work type ref 1 = SWITCH(Sheet1[Project Portfolio Name]="none",
Sheet1[Project ID]="XX1001","Vacation",
Sheet1[Project ID]="XX1002","Vacation",
Sheet1[Project ID]="XX1003","Vacation",
Sheet1[Project ID]="XX1004","Vacation",
Sheet1[Project ID]="XX1005","Vacation",
Sheet1[Project ID]="XX1006","Vacation","Non- Proj",
Sheet1[Project Portfolio Name]="Run the Business (RTB)","RTB")

 

maybe you can try

Column = IF(Sheet1[Project Portfolio Name]="none",SWITCH(TRUE(),Sheet1[ProjectID] in {"XX1001","XX1002","XX1003","XX1004","XX1005","XX1006"},"VACATION","NON-PROJ"),IF(Sheet1[Project Portfolio Name]="Run the Business (RTB)","RTB"))

if the value of project porfolio name is blank instead of TEXT "none", you can try

Column = IF(isblank(Sheet1[Project Portfolio Name]),SWITCH(TRUE(),Sheet1[ProjectID] in {"XX1001","XX1002","XX1003","XX1004","XX1005","XX1006"},"VACATION","NON-PROJ"),IF(Sheet1[Project Portfolio Name]="Run the Business (RTB)","RTB"))

1.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@Anonymous 

Column = if(Sheet1[Month]="Jan","Fisrt",
IF(Sheet1[Month]="feb",what's the result for feb?
IF(Sheet1[Num]=2,"Second","Good",//this IF staement is completed, you can't have the below statments
IF(Sheet1[Month]="Mar","Third"))))

please make sure if statment has three parameters (condition, true, false)

 

SWITCH

What's the higher priority column of this? you can't put two columns in the switch. please share the sample data and explain the logic.

 

Work type ref 1 = SWITCH(Sheet1[Project Portfolio Name]="none",
Sheet1[Project ID]="XX1001","Vacation",
Sheet1[Project ID]="XX1002","Vacation",
Sheet1[Project ID]="XX1003","Vacation",
Sheet1[Project ID]="XX1004","Vacation",
Sheet1[Project ID]="XX1005","Vacation",
Sheet1[Project ID]="XX1006","Vacation","Non- Proj",
Sheet1[Project Portfolio Name]="Run the Business (RTB)","RTB")

 

maybe you can try

Column = IF(Sheet1[Project Portfolio Name]="none",SWITCH(TRUE(),Sheet1[ProjectID] in {"XX1001","XX1002","XX1003","XX1004","XX1005","XX1006"},"VACATION","NON-PROJ"),IF(Sheet1[Project Portfolio Name]="Run the Business (RTB)","RTB"))

if the value of project porfolio name is blank instead of TEXT "none", you can try

Column = IF(isblank(Sheet1[Project Portfolio Name]),SWITCH(TRUE(),Sheet1[ProjectID] in {"XX1001","XX1002","XX1003","XX1004","XX1005","XX1006"},"VACATION","NON-PROJ"),IF(Sheet1[Project Portfolio Name]="Run the Business (RTB)","RTB"))

1.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

@Anonymous , like this try SWITCH true

SWITCH(true(), Sheet1[Project Portfolio Name]="none","Vacation",
Sheet1[Project ID]="XX1001","Vacation",
Sheet1[Project ID]="XX1002","Vacation",
Sheet1[Project ID]="XX1003","Vacation",
Sheet1[Project ID]="XX1004","Vacation",
Sheet1[Project ID]="XX1005","Vacation",
Sheet1[Project ID]="XX1006","Vacation","Non- Proj",
Sheet1[Project Portfolio Name]="Run the Business (RTB)","RTB")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Stilll the same 😞

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.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

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.