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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
PBR_
Frequent Visitor

Nested IF statements with more than 3 arguments

I'm brand new to Power BI and am trying to add a new column to my current fields.

 

I have an existing column (Data[FIELD]) that consists of whole numbers. The new column (fxSHIFT) I am trying to create needs to associate these values with letters.

 

The following statement returns the error "Too many arguments were passed to the IF function. The maximum argument count for the function is 3.":

fxSHIFT = if(Data[FIELD]<9, "D",If(Data[FIELD]<14,"M", IF(Data[FIELD]<19, "E", "N")))
 
The end result I'm looking for would be:
Data[FIELD]fxSHIFT
0D
1D
2D
3D
4D
5D
6D
7D
8D
9M
10M
11M
12M
13M
14E
15E
16E
17E
18E
19N
20N
21N
22N
23N
 
Any workarounds for this argument limit?
1 ACCEPTED SOLUTION
vicky_
Super User
Super User

I don't think it's an issue with the argument limit - it's probably a syntax issue (missing a bracket or an extra comma somewhere, something like that). I would suggest using a switch statement for readability (it's pretty much the same as an if statement).

measure = SWITCH( TRUE(),
    Data[FIELD] < 9, "D",
    Data[FIELD] < 14, "M",
    Data[FIELD] < 19, "E",
    "N"
)

 

View solution in original post

2 REPLIES 2
vicky_
Super User
Super User

I don't think it's an issue with the argument limit - it's probably a syntax issue (missing a bracket or an extra comma somewhere, something like that). I would suggest using a switch statement for readability (it's pretty much the same as an if statement).

measure = SWITCH( TRUE(),
    Data[FIELD] < 9, "D",
    Data[FIELD] < 14, "M",
    Data[FIELD] < 19, "E",
    "N"
)

 

PBR_
Frequent Visitor

Perfect! The switch true statement worked great.

Thanks for your help!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.