Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

filter affects background color of expression

I created a Trellis barchart with 2 dimensions (territory and orderyear) and 1 expression (sum of OrderSubTotal)

In order to avoid that document filters effect the chart, the {1} set identifier is used in the expression =Sum ({1}OrderSubTotal)

To emphasize the last year, the background color of the expression was changed to =if(OrderYear=$(LastYear),lightred(),color(1))

If you filter the data, e.g. territory='Europe', the values of the chart don't change, but the background color is also filtered (see screenshot)

How to overcome this problem?

trellian.jpg

1 Solution

Accepted Solutions

Re: filter affects background color of expression

Try this instead to ingore the selections for the background color expression too:

=if(only({1}OrderYear)=$(LastYear),lightred(),color(1))


talk is cheap, supply exceeds demand
5 Replies

Re: filter affects background color of expression

Try this instead to ingore the selections for the background color expression too:

=if(only({1}OrderYear)=$(LastYear),lightred(),color(1))


talk is cheap, supply exceeds demand
chauhans85
Esteemed Contributor

Re: filter affects background color of expression

Please  try below code

Sum ({<territory=>}OrderSubTotal)

it will avoid territory field selection and color also will remains .


Employee
Employee

Re: filter affects background color of expression

Hey Hans,

Try something like,

=if(OrderYear=Max({1}TOTAL $(LastYear)),lightred(),color(1))


jolivares
Valued Contributor

Re: filter affects background color of expression

Hi, try this expressions:

Sum({<Territory=,OrderYear=>} OrderSubTotal)

For the background color:

If(Only({<Territory=,OrderYear=>} OrderYear)=Max(Total {<territory=,OrderYear=>} OrderYear),LightRed(),Color(1))

Not applicable

Re: filter affects background color of expression

Indeed,

Adding the 'Only' agregate function with de {1} did the trick!!!

Now I have a great example for my students where the ONLY is to be used ;-)

Thanks

Community Browser