Takuya Kobayashi Posted April 28, 2020 Share Posted April 28, 2020 Hi, Iam trying to create calculated column using if function. Is it possible to insert another if function within if function such as below example: If (A,"1", IF (B,A"2","3")) It does not seem to work. So if condition A satisfies, I would like the function to return"1" , otherwise if condition B satisfies then "2", otherwise "3". I am still quite new to Spotfire, help is really appreciated. Link to comment Share on other sites More sharing options...
Karan Nisar Posted April 28, 2020 Share Posted April 28, 2020 You can use this expression If([Column1] = value1, if([Column2] =value2, value3, value4), value5) Here if the column1 is equal to value1 the next if statement will be executed. So it will check if Column2 is equal to value2. If Column2 is equal to value2, value3 would be returned or else value4 will be returned. If Column1 is not equal to value1, it would return value5 Hope that helps. Link to comment Share on other sites More sharing options...
Shashank Gurnalkar Posted April 29, 2020 Share Posted April 29, 2020 You can use Case statements as well, as they are easier to understand such use cases: Case When Your_Condition_A then 1 When Your_Condition_B then 2 Else 3 EndIf you put 1,2 and 3 in double-quotes, the resulting column would be evaluated to String data type. Link to comment Share on other sites More sharing options...
Takuya Kobayashi Posted May 1, 2020 Author Share Posted May 1, 2020 Thank you all. IT worked using "case" and "IF" as mentioned in answer. I really appreciate this. Thank you so much for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now