Get Free Trial

Calculated value with If statement

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

Iryna Kulchytska Iryna Kulchytska Flexmonster April 20, 2016

Hello David,
Here is a jsfiddle example on using calculated value with if statement:
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,

Tanya Gryshko Tanya Gryshko Flexmonster December 7, 2016

Hello David and all Flexmonster users,
Check the updated sample for version 2.3:
Regards, Tanya

Please login or Register to Submit Answer