Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Set analysis AND combination

I want to count unique DIMENSION1 where there is a record that has DIMENSION2 = 'VAL 1' AND DIMENSION3 = 'VAL A' but also has a record DIMENSION2 = 'VAL 2' AND DIMENSION3 = 'VAL B'.

Now normally I would attempt this in the script but in this case, I need to look at the situation dynamically (so the user can pick which value combinations are relevant).

Is this possible in set analysis?

 

 

 

1 Solution

Accepted Solutions
Highlighted

Try this

=Count({$<DIM1 = P({<DIM2 = {'C'}, DIM3 = {'CAT5'}>})*P({<DIM2 ={'A'}, DIM3 = {'CAT1'}>})>} DISTINCT DIM1)

View solution in original post

6 Replies
Highlighted
Creator III
Creator III

Hey Felix,
In your demo you want to count the number of YES by the selection of the user?
So if i choose
DIM1 = 1
DIM2 = A
DIM3 = CAT1

The expression should return 1?
Highlighted
Specialist II
Specialist II

Please try:

Count({$<DIMENSION2 = {'VAL 1'}, DIMENSION3 = {'VAL A'} > + < DIMENSION2 ={'VAL 2'} ,DIMENSION3 ={'VAL B'}>} DIMENSION1)

Highlighted
Creator III
Creator III

if you want to count the YES depending on the user's selection try this one:
=COUNT({<DIM1={'$(=GetFieldSelections(DIM1))'} ,DIM2={'$(=GetFieldSelections(DIM2))'} , DIM3={'$(=GetFieldSelections(DIM3))'} >} IF(COUNTME='YES', COUNTME))
Highlighted

Try this

=Count({$<DIM1 = P({<DIM2 = {'C'}, DIM3 = {'CAT5'}>})*P({<DIM2 ={'A'}, DIM3 = {'CAT1'}>})>} DISTINCT DIM1)

View solution in original post

Highlighted
Contributor III
Contributor III

Hi Gf,
Sorry my ability to articulate the problem isn't great and I believe that what you have set out here would work if I had the ability to do the COUNTME field but I only included that in the demo file to show the relevant lines. I can't do this in the real example.

Some context might help - we're looking at a bunch of students that have achieved grades A-E by months. I'm trying to create a visualisation that shows how many students that were achieving grade Bs in May 2019 and getting As in Jun 2019 based on selection:

Visualisation.png

 

Highlighted
Contributor III
Contributor III

This seems to work.. That is some fantastic set analysis witchcraft. I'll look up the P() and what that is up to.

Thank you sir.