If else statement with calculated return values

Hello Team,
I am facing a issue to return a calculated return statement using if else statement.
Please suggest the best nodes to solve this case

Data Set
Col1: Group1
A
B
C
D

Col2:PY Rate
1
2
3
4

Col3: FY Rate
4
3
2
1

Required Output Column
4
0.66
0.66
4

Logic:
if Col1 = {“A” , “C”}
Return Col3 / Col2
Else
Return Col2 / Col3

Thank You

Hi,
You can use a Column Expressions node with the following expression:

column("Col1") === "A" || column("Col1") === "C" ? (column("Col3") / column("Col2")) : (column("Col2") / column("Col3"))

Kind regards,
Alexander

4 Likes

Hello Alexander,
This works perfectly.
Thank you for the solution … :grinning: :grinning:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.