Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
I am trying to apply the colors conditionally so writing a expression to achieve this.
Pick(Match(Id='Apple','Bird','Other'),Red(),Blue(),Green()). But i see black color by default. I dont want to see black colour in my chart and want to show conditionally colors that i mentioned in the formula. Can some one help me on this? Attached my qvw.
A couple of issues. First, syntactically, there should not be a = in your Match(), that should be a comma.
Pick(Match(Id,'Apple','Bird','Other'),Red(),Blue(),Green())
However that won't work because your Id values are not "Apple" etc, they are A, B, C, D, E and you are putting them in buckets with a calculated Dimension. But you can't reference the Calculated value in the background expression. You need to write it like:
Pick(Max(WildMatch(Id,'A','B','*')),Red(),Blue(),Green())
I used Max(WildMatch) as a way to avoid writing Green() three times. That might not match your real case.
Another approach is to just paste your calculated Dim expression in as the Match() value. That would work in this case, but only if you rewrote your calculated expression as:
=Aggr(If(Id='A','Apple',if(Id='B','Bird',If(Max(Match(Id, 'C','D','E')),'Other'))), Id)
and then:
Pick(Match(Aggr(If(Id='A','Apple',if(Id='B','Bird',If(Max(Match(Id, 'C','D','E')),'Other'))), Id)
,'Apple','Bird','Other'),Red(),Blue(),Green())
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com
A couple of issues. First, syntactically, there should not be a = in your Match(), that should be a comma.
Pick(Match(Id,'Apple','Bird','Other'),Red(),Blue(),Green())
However that won't work because your Id values are not "Apple" etc, they are A, B, C, D, E and you are putting them in buckets with a calculated Dimension. But you can't reference the Calculated value in the background expression. You need to write it like:
Pick(Max(WildMatch(Id,'A','B','*')),Red(),Blue(),Green())
I used Max(WildMatch) as a way to avoid writing Green() three times. That might not match your real case.
Another approach is to just paste your calculated Dim expression in as the Match() value. That would work in this case, but only if you rewrote your calculated expression as:
=Aggr(If(Id='A','Apple',if(Id='B','Bird',If(Max(Match(Id, 'C','D','E')),'Other'))), Id)
and then:
Pick(Match(Aggr(If(Id='A','Apple',if(Id='B','Bird',If(Max(Match(Id, 'C','D','E')),'Other'))), Id)
,'Apple','Bird','Other'),Red(),Blue(),Green())
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com