Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have data that looks something like this:
Location | Weekday visitors | Weekend visitors | Weekday sales | Weekend Sales |
---|---|---|---|---|
A | 12 | 34 | 6 | 20 |
B | 16 | 21 | 10 | 3 |
C | 15 | 32 | 3 | 15 |
D | 17 | 45 | 8 | 25 |
I would like to be able to have a single chart table that shows all the locations, but displays either the Weekday stats or the weekend stats based based on a user selection.
So it would be something like this:
Weekday Stats
Weekend Stats
(some way for a user to select between the two)
Location | Visitors | Sales |
---|---|---|
A | 12 | 6 |
B | 16 | 10 |
C | 15 | 3 |
D | 17 | 8 |
Is this possible? Perhaps I need to do something when I load the data?
Thanks.
Hi Tanya,
yes, you can do it if you load an extra field "Measure" with the possible values like "Weekday Stats" and "Weekend Stats", and let users select the value from a Filter.
In the chart, have a conditional expression that shows one formula or another, based on the selected value.
cheers,
Oleg Troyansky
Check out my new book QlikView Your Business - The Expert Guide for QlikView and Qlik Sense
Check the attached
Script:
Table:
LOAD Location,
[Weekday visitors],
[Weekend visitors],
[Weekday sales],
[Weekend Sales]
FROM
[https://community.qlik.com/thread/214279]
(html, codepage is 1252, embedded labels, table is @1);
Selection:
LOAD * Inline "
Field, Visitor, Sales
WeekDay, Sum([Weekday visitors]), Sum([Weekday sales])
WeekEnd, Sum([Weekend visitors]), Sum([Weekend Sales])
";
Straight Table
Dimension
Location
Expressions
1) =$(=Visitor)
2) =$(=Sales)
Maybe like
LOAD
Location,
"Weekday visitors" as Visitors,
"Weekday sales" as Sales,
'Weekday stats' as type
FROM YourTableSource;
Concatenate
LOAD
Location,
"Weekend visitors" as Visitors,
"Weekend sales" as Sales,
'Weekend stats' as type
FROM YourTableSource;
Well, just saw that it is Qlik Sense. Not sure if this will work in Sense or not
UPDATE: Seemed to have worked (with the only problem that we don't have the option to make the filter box have 'Always One Selected Value'). This might become an issue when user selects both weekday and weekend in the field filter.
But check it out
Thanks Sunny. This answered my question (except for the single selection part).
What is the single selection part?
What you mentioned above - that it fails if the user selects multiple filter entries. I need some way to restrict this to a single selection.
May be reddys310 can help here
Hi Tanya,
Qlik by default allows multiple selection.If you have to restrict to have a single selection, then it would be better if you have toggle buttons which is an extension. Check Qlik branch if you can find an extension for this.