Forum Discussion
Nested IF
- 2 months ago
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] )
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:
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
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.
- AllanBerces2 months agoPost Prodigy
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
- MFelix2 months agoSuper User
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] )- AllanBerces2 months agoPost Prodigy
Hi MFelix V-yubandi-msft thnak you very much working good