hi all, inputting a nested if statement to test whether we are on time, behind, or completed certain projects. if complete you get a green, if % complete is 0 or BLANK and the start date has passed, you get a RED, and so on. its the second test above that is causing issues.
i get no syntax errors but the contents of the new column end up being "Error". when clicked on, i get the following:
Expression.Error: We cannot convert the value null to type Logical.Details: Value= Type=[Type]
so, how do i write in the test for empty/blank? i have tried [#"% Complete"]="" and [#"% Complete"]=null in place of the Text.Length([#"% Complete"])=0
second question, while i am at it. should i bracket the OR conditions in the second argument? it should read, if either of these AND Today is greater than the start date, NOT if %Complete = 0 OR both of these.
Code:
if [#"% Complete"]=100
then "GREEN"
else if [#"% Complete"]=0 or Text.Length([#"% Complete"])=0 and DateTime.Date( DateTime.LocalNow() )>[Start Date for Next Activity]
then "RED"
else if DateTime.Date( DateTime.LocalNow() ) - ([Start Date for Next Activity]+(([#"% Complete"]/100)*[#"# Days for Next Activity"]))>14
then "RED"
else "GREEN"
i get no syntax errors but the contents of the new column end up being "Error". when clicked on, i get the following:
Expression.Error: We cannot convert the value null to type Logical.Details: Value= Type=[Type]
so, how do i write in the test for empty/blank? i have tried [#"% Complete"]="" and [#"% Complete"]=null in place of the Text.Length([#"% Complete"])=0
second question, while i am at it. should i bracket the OR conditions in the second argument? it should read, if either of these AND Today is greater than the start date, NOT if %Complete = 0 OR both of these.