Calculated value with If statement

Answered
David Chen asked on April 20, 2016

Anyone have a jsfiddle example on using calculated value using if statement
What I want to see is
If colorColumn=red then numBasketballColumn / numRedBallColumn
else if colorColumn=white then numSoccorColumn / numWhiteBallColumn
else if ....
else ...
 
Is is like 
 
SyntaxEditor Code Snippet

 measures: [ 
        {uniqueName: 'Calculated Field', formula: ""If(,,)"", calculated: true },

2 answers

Public
Iryna Kulchytska Iryna Kulchytska Flexmonster April 20, 2016

Hello David,
 
Here is a jsfiddle example on using calculated value with if statement: https://jsfiddle.net/irynakulchytska/vsk1fLq4/
You cannot compare hierarchy members in it, you can address measures (Price, Quantity) and their values.
 
Please let me know if the sample works for you.
 
Kind regards,
Iryna

Public
Tanya Gryshko Tanya Gryshko Flexmonster December 7, 2016

Hello David and all Flexmonster users,
Check the updated sample for version 2.3: https://jsfiddle.net/flexmonster/pwn4tk84/.
Regards, Tanya

Please login or Register to Submit Answer