Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to create a calculated dimension based on about seven different variables, and I believe the way that I need to do this is to string together multiple If Statements, one for each of the possible outputs that I need. I have to do this 29 times, but I stopped after four IF statements to check my code and I can't figure out the error.
Code:
IF ([Variable 1] = 'X1' AND Variable2= 'Z1' AND [Variable 3] < 12, "X1|Z1|<12",
IF ([Variable 1] = 'X2' AND Variable2= 'Z1' AND [Variable 3] >= 12, "X2|Z1|>=12",
IF ([Variable 1] = 'X1' AND Variable2= 'Z2' AND [Variable 3] >= 12, "X1|Z2|>=12",
IF ([Variable 1] = 'X2' AND Variable2= 'Z2' AND [Variable 3] < 12, "X1|Z2|<12",
"Other"))))
What I believe should happen is if Variable 1 = X1, Variable 2 = Z1, and Variable 3 <12, then the dimension should return "X1|Z1|<12". If none of those happen, it should go to the next statement, on to the end, and if none of them are returned, it should return "Other". However, all it says is "Error in Expression" and no more detail.
Thanks!
Start by whittling it down to just one if() statement and see if that works. If it doesn't, check the syntax at the bottom of the expression editor to see if your variables are getting parsed as you expect, which would be the most likely culprit in this scenario. I also think you want to be using single quotes rather than double quotes for the strings you return.
Start by whittling it down to just one if() statement and see if that works. If it doesn't, check the syntax at the bottom of the expression editor to see if your variables are getting parsed as you expect, which would be the most likely culprit in this scenario. I also think you want to be using single quotes rather than double quotes for the strings you return.
Thanks! It was the double quotes that was causing the error. Otherwise everything worked.