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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
gfuellerer
Contributor
Contributor

Pivot Table Filtering

I have loaded the following dataset of answers:
answers:
NoConcatenate
LOAD * INLINE [
id,regid,constructionsite,answerid,answertext
1,1,site I,a1,yes
2,1,site I,a2,no
3,1,site I,a3,partially
4,1,site I,a4,applicable
5,2,site I,a1,yes
6,2,site I,a2,yes
7,2,site I,a3,applicable
8,2,site I,a4,applicable
9,3,site I,a1,no
10,3,site I,a2,yes
11,3,site I,a3,partially
12,3,site I,a4,applicable
13,4,site II,a1,yes
14,4,site II,a2,no
15,4,site II,a3,partially
16,4,site II,a4,partially
17,5,site II,a1,no
18,5,site II,a2,yes
19,5,site II,a3,applicable
20,5,site II,a4,applicable
21,6,site II,a1,no
22,6,site II,a2,no
23,6,site II,a3,partially
24,6,site II,a4,applicable
];

I  have then created a pivot table and a pie chart for question / answer a1:

Screenshot of sheetScreenshot of sheetProperties of PivottableProperties of PivottableProperties of PiechartProperties of PiechartFilter for yesFilter for yesDesired filter resultDesired filter result
The measure of the pie chart is as follows: Count({<answerid={'a1'}>} distinct [regid])
I would like to filter the pivot table for the yellow marked lines, but I have now idea how to achieve this.
If I filter for yes, then the columns of the pivot table with answers not yes vanish.

Labels (2)
3 Replies
marcus_sommer

You may try an expression like:

 Count({< regid = p({< answerid={'a1'}, answertext = {'yes'}>} regid)>} distinct [regid])

gfuellerer
Contributor
Contributor
Author

Yes, the p() function seems to be a crucial step to solve this. The question is how to transport the information that 'a1' is relevant when clicking 'yes' in the pie chart because this filters all answers 'yes' to all questions (also in 'a2'). I have tried a different approach when loading the data:
Dual(answertext,AutoNumber(answerid & answertext)) as answertextDual
When doing this each answerid is combined with the answertext, that means, when clicking yes in the pie chart also transports the info for the question / answer implicitly but one drawback then is in the selection pane:
Bild (7).png

You then get several yes / no because now these values are different for qlikview

marcus_sommer

I could imagine that a more or less similar expression might be applicable - which may also include some statements to ignore certain selections.

The complexity of such approaches might be quite high ... Maybe this could be reduced by using one or more not connected island-tables for the selections which are queried in a similar way with p() or e() like above hinted which had the benefit not to restrict the sub-set per the existing associations. Here a dummy example:

count({< ID = p(IslandID), Text = p(IslandText)>} Field)