Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to keep one domain value constant in a Trellis chart

I want to show the comparison between two companies, let's say Acme and whatever company the user selects, in a trellis chart that sums Sales by Region and Product.

The hard part is that I want Acme to always be one of the companies, and the other company to be whatever the user selects. Does anyone know how to do this?

Ideally the chart would look like this, where ACME is always the first company regardless of user selection.

error loading image

And here's the script I used to generate the data:

Table:LOAD if(recno() / 9 <= 1, 'Product A', if(recno() / 9 > 1 AND recno() / 9 <= 2, 'Product B', if(recno() / 9 > 2, 'Product C'))) AS Product, if(mod(floor((recno()-1)/3), 3) = 0, 'Texas', if(mod(floor((recno()-1)/3), 3) = 1, 'California', if(mod(floor((recno()-1)/3), 3) = 2, 'Georgia'))) AS Region, if(mod((recno()-1), 3) = 0, 'Acme', if(mod((recno()-1), 3) = 1, 'Company A', if(mod((recno()-1), 3) = 2, 'Company B'))) AS Carrier, rand() * 1000 AS SalesAUTOGENERATE 27;

Thanks to anyone who can help!

6 Replies
Not applicable
Author

In the chart options

use Region as your dimension

Then in your expressions tab, use something like this to limit it only to Acme:

sum({$<Carrier={"Acme"}>} Sales)

Not applicable
Author

Hey Bryan,

Thanks for the response.

If I have Region as my chart dimension, won't that make the trellis split the different charts based on Region, instead of on Company as in the chart in the original post?

When I put Region as the dimension, I get this chart, which is not what I want:

Not applicable
Author

It looks like you used Product for your dimension.

Dimension is your x-axis on the chart.

On your original posting you have it listed by region. Now to limit the data to the companies, you do so in the expressions tab or by limiting it in your script. Which since you want to compare the data, it's easier to limit it in the script.

To replicate your chart from your original post, you can use Region as your dimension in your expressions tab, the following three expressions:

sum({$<Carrier={'Acme'}, Product={'Product A'}>} Sales)

sum({$<Carrier={'Acme'}, Product={'Product B'}>} Sales)

sum({$<Carrier={'Acme'}, Product={'Product C'}>} Sales)

Basically, the expressions are saying take the Sum of sales where carrier = acme and where product = specified product. With the data limited it will assign it to it's corresponding dimension.

Is that what you were asking? If you can view it, I uploaded what I think you're referencing.

Not applicable
Author

Bryan,

Yes, that is what I want, but all as one chart so that it will minimize/maximize all at once (instead of having to minimize/maximize them as two separate charts). The only way I can think of to do this is as a Trellis chart. Do you know how to do it all as one chart?

Not applicable
Author

Well to turn it into a trellis, I went to the dimensions tab, and clicked on the trellis button on the lower left, checked Enable Trellis Chart, hit OK.

Then I set the Dimension fields as Carrier and Region (in that order).

then for expressions:

sum({$<Product={"Product A"}>} Sales)

sum({$<Product={"Product B"}>} Sales)

sum({$<Product={"Product C"}>} Sales)

Still trying to figure out how to make Acme show at all times though.

Not applicable
Author

I've been looking around and I can't find an elegant way to make always show Acme.

However, I did find a solution of the sort.

If you go to the corresponding list box, go to Selection Style Override and select either Windows Checkboxes or Corner tag. I think this is probably the most obvious way to show an end user they can keep Acme selected without explaining you can press ctrl to select multiple options.

Perhaps someone knows of a better way to keep one value always selected.