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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
AllanBerces
Post Prodigy
Post Prodigy

Nested IF

Hi to all can anyone help me on my calculated column. Basically im not sure how to explain it well but the formula in excel is like this

RESULT=IF(A2="Article",IF(C2<0,IF(B2>0,1,0),0),IFERROR(D2,1))

AllanBerces_0-1780041700267.png

OUTPUT

AllanBerces_1-1780041729747.png

ART/OBJOBJECTREQUIREDSTOCK DEV. (AGAINST RCVD STOCK)O/S AS PER STATUSRESULT
Article0.7-0.7#N/A1
Object0#N/A#N/A1
Object0#N/A#N/A1
Object0#N/A#N/A1
Object0#N/A#N/A1
Article18-18#N/A1
Object0#N/A#N/A1
Object0#N/A#N/A1
Article0000
Article0400
Article0000
Article11.6800
Object0#N/A00
Object0#N/A00
Object0#N/A00



1 ACCEPTED SOLUTION

Hi @AllanBerces ,

 

If you need to have it on a calculated column and the errors are are blank values then just use this formula:

 

Result =
         IF('Table'[ART/OBJ] = "Article" ,
		 IF ('Table'[STOCK DEV. (AGAINST RCVD STOCK)] < 0 ,
			IF( 'Table'[OBJECTREQUIRED] > 0 , 1, 0), 0), 
				IF(ISBLANK('Table'[O/S AS PER STATUS]),1, 'Table'[O/S AS PER STATUS])
)

 

Or

Result =
SWITCH(TRUE(),
    'Table'[ART/OBJ] = "Article" && 'Table'[STOCK DEV. (AGAINST RCVD STOCK)] < 0 && 'Table'[OBJECTREQUIRED] > 0 ,1,
      ISBLANK('Table'[O/S AS PER STATUS]), 1,
           'Table'[O/S AS PER STATUS]
	)

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

5 REPLIES 5
V-yubandi-msft
Community Support
Community Support

Hi @AllanBerces ,

When you have a moment, please review the latest response from @MFelix  and let us know if it meets your expectations. If you need any further information or clarification, please let us know.

Thanks for your input @MFelix .

 

Regards,
Yugandhar.

MFelix
Super User
Super User

Hi @AllanBerces ,

 

If you are getting this information from the Excel file be carefull because the #N/A will not load the data properly and you will get an error on the cells like below:

MFelix_0-1780044054265.png

 

This will make your power query not to load all rows so you also need to handle the errors, however in your formula you are also not considering if there is an error on cell C3 so this can mess up your calculation because if you have an article with C column error then you will get an error on the final colum try the following code on Power Query:

try if [#"ART/OBJ"] = "Article" then 
      
      if [#"STOCK DEV. (AGAINST RCVD STOCK)"] <0 then 
        1 else       
        
        if [OBJECTREQUIRED] > 0 then 1 else 0


         else [#"O/S AS PER STATUS"]

         otherwise 1

MFelix_1-1780044878503.png

 

You should also handle those errors doing the replacment of values:

 Table.ReplaceErrorValues(#"Personalizado Adicionado", {{"O/S AS PER STATUS", 0}})

Where there is Zero just place whatever value you think is correct.

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Hi @MFelix thank you for the reply, but can i have it in calculated column.i'm doing it on the calculated column. The #N/A shows blank on my calculated column

Hi @AllanBerces ,

 

If you need to have it on a calculated column and the errors are are blank values then just use this formula:

 

Result =
         IF('Table'[ART/OBJ] = "Article" ,
		 IF ('Table'[STOCK DEV. (AGAINST RCVD STOCK)] < 0 ,
			IF( 'Table'[OBJECTREQUIRED] > 0 , 1, 0), 0), 
				IF(ISBLANK('Table'[O/S AS PER STATUS]),1, 'Table'[O/S AS PER STATUS])
)

 

Or

Result =
SWITCH(TRUE(),
    'Table'[ART/OBJ] = "Article" && 'Table'[STOCK DEV. (AGAINST RCVD STOCK)] < 0 && 'Table'[OBJECTREQUIRED] > 0 ,1,
      ISBLANK('Table'[O/S AS PER STATUS]), 1,
           'Table'[O/S AS PER STATUS]
	)

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Hi @MFelix @V-yubandi-msft thnak you very much working good

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.