Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Different selections for two expressions in a chart

I want to make a chart with 2 expressions - Sales and Cost. The way the data is structured, i need different filters on these two to get the right number. For instance, I have two fields "A" and "B" with values "y" and "n" for both. I want "y" to be selected for both A & B to get the right Cost, and don't want any filters on for Sales.

Now if i have a list box and select the "y"s for both A and B, i'd get the right cost but my sales number is off. Is there a way i can work around this? Tried putting an if condition in the expression and calculation condition too but it didn't help.

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can use set analysis expressions:

Cost: sum({<A={'y'},B={'y'}>}CostValue)

Sales: sum(SalesValue)

Replace A, B, CostValue and SalesValue with the names of your fields.


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can use set analysis expressions:

Cost: sum({<A={'y'},B={'y'}>}CostValue)

Sales: sum(SalesValue)

Replace A, B, CostValue and SalesValue with the names of your fields.


talk is cheap, supply exceeds demand
Not applicable
Author

Awesome! You're a life saver!

I tried Set but my syntax was off. That'd make sense.

One more question - in a chart, how can i supress/hide some values of a dimension? And i don't want to write the ones selected, but the ones i don't want included (because they are much lesser).

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can use -= to exclude values: {<A -= {'y','z'} >}. The expression editor will mark this as incorrect syntax, but that's a bug in the expression editor.


talk is cheap, supply exceeds demand