Vizlib Home Try Vizlib

Vizlib filter with condition

I am having hard time trying to use a conditional statement for the filter. Please help!

For example:

I have couple value that I want to display on the filter button.

If A+ and B+ then "TypeA+/TypeB+"

If A+ and B- then "TypeA+/TypeB-"

If A- and B- then "TypeA-/TypeB-"

If A- and B+ then "TypeA-/TypeB+"

so far I can only made it work with two

if(match(type='A+' and type='B+', type='A+' and type='B-'), 'TypeA+/TypeB+', 'TypeA+/TypeB-)

if I add another condition in there I will get Error in expression: if takes 2-3 parameters.  Any suggestion? Thanks!

  • Hi David,
    from the performance standpoint and ease of use,
    if the two fields are in the same table in the source data
    I would recommend that you'll create the joint field in the load process.
    It can be done using this expression in the load script:
    type1 & '\' & type2 as type3 
    then use type3 in your app as a dimension. 
    if you can't do it in the script i would recommend creating a master dimension using this expression:
    aggr(type1 & '\' & type2,type1,type2)

Login to post a comment