Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Gysbert_Wassenaar

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

View solution in original post

5 Replies
Gysbert_Wassenaar

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
SunilChauhan
Champion
Champion

Please  try below code

Sum ({<territory=>}OrderSubTotal)

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


Sunil Chauhan
Alexander_Thor
Employee
Employee

Hey Hans,

Try something like,

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


jolivares
Specialist
Specialist

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
Author

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