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
edcdcpowerbi
Helper I
Helper I

Nested IF statement

I am needing to add a third if statement below, which replaces blank values with a 0. 

On its own it works fine, the other two if statements work without this third being added. 

 

How do i correctly insert this Third IF statement, as it stands i get a semantic error saying 'Too many arguments passed, 3 is the maximum'

 

RETURN
IF(
ISBLANK( SliderValue ),0, SliderValue,
IF( SliderValue > 0, ProjRR,
IF(SliderValue = 0, Actual)
)
)

1 ACCEPTED SOLUTION

The way DAX handles BLANKS can be somewhat confusing so in this case it can be something related to DAX never considering the value to be blank and evaluating it as FALSE everytime. A possible workaround can be:

 

SWITCH(
TRUE(),
SliderValue = BLANK(), 0,
SliderValue = 0, Actual,
SliderValue > 0, ProjRR,
SliderValue
)

 

Check out this article as it may help you in this case or in a similar one in the future!

 

Hope this answer solves your problem! If you need any additional help please tag me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!

Best regards,
Gonçalo Geraldes

View solution in original post

9 REPLIES 9
goncalogeraldes
Super User
Super User

Hello there @edcdcpowerbi , you already have three arguments in the highlighted part of your code. Therefore, all your arguments after it are causing the error. I think you can remove the "SliderValue" argument, or use a SWITCH() function instead of nested IFs() since it behaves almost like an IF THEN ELSE.

 

RETURN
IF(
ISBLANK( SliderValue ),0, SliderValue,
IF( SliderValue > 0, ProjRR,
IF(SliderValue = 0, Actual)
)
)

 

Hope this answer solves your problem! If you need any additional help please tag me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!

Best regards,
Gonçalo Geraldes

Thanks for the help @goncalogeraldes. i did try to remove SliderValue, but to no avail. 

I did try the switch statement but it return True, instead of the values i wanted, where have i gone wrong? 

 

SWITCH(SliderValue,
IF(ISBLANK(SliderValue),0,SliderValue),
SliderValue = 0, Actual,
SliderValue>0,ProjRR
)

@edcdcpowerbitry this! 

SWITCH(
TRUE(),
ISBLANK(SliderValue),0,
SliderValue = 0, Actual,
SliderValue > 0,ProjRR,
SliderValue
)

 

Hope this answer solves your problem! If you need any additional help please tag me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!

Best regards,
Gonçalo Geraldes

@goncalogeraldes it still displays (Blank) instead of zero im afraid

@edcdcpowerbi please send the full formula then. What is the SliderValue?

sure, here it is @goncalogeraldes 

 

VAR Actual = [Recycling Rate (PET)]
VAR AverageR = [Median Recycling Rate (PET)]
VAR SliderValue = [PETRecyclingRateOverride Value]
VAR ProjRR =
IF( SliderValue > 0, DIVIDE( SliderValue, 100, 0 ), Actual ) //var AverageRR = IF (SliderValue > 0, DIVIDE(SliderValue,100,0), AverageR)
RETURN
//IF ( SELECTEDVALUE (Jurisdiction[DRS Status]) = "Existing DRS" , ProjRR, AverageRR)

SWITCH(
TRUE(),
ISBLANK(SliderValue),0,
SliderValue = 0, Actual,
SliderValue > 0,ProjRR,
SliderValue
)

The way DAX handles BLANKS can be somewhat confusing so in this case it can be something related to DAX never considering the value to be blank and evaluating it as FALSE everytime. A possible workaround can be:

 

SWITCH(
TRUE(),
SliderValue = BLANK(), 0,
SliderValue = 0, Actual,
SliderValue > 0, ProjRR,
SliderValue
)

 

Check out this article as it may help you in this case or in a similar one in the future!

 

Hope this answer solves your problem! If you need any additional help please tag me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!

Best regards,
Gonçalo Geraldes

that worked perfectly, thank you! 

Glad to be of help! 

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.