Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
sigurdfjeld
Partner - Contributor II
Partner - Contributor II

Excluding dimensional values

I have a dataset somewhat like this:

LOAD * INLINE [

    UserID, Comment, Year, ID

    1, a, 2015 ,1

    2, a, 2015 ,2

    3, a, 2015 ,3

    4, a, 2015 ,4

    2, b, 2015 ,5

    3, b, 2015 ,6

    1, c, 2013 ,7

    2, c, 2014 ,8

    3, c, 2014 ,9

    4, c, 2015 ,10

    2, d, 2013 ,11

    3, d, 2013 ,12

    4, d, 2013 ,13

    1, a, 2016 ,14

];

I want to select all users that have comment 'a' but not comment 'b'. I can do the count like this:

count(DISTINCT {$<Comment = {'a'}, UserID = E({$<Comment = {'b'} >} UserID) >} UserID)

How would i go about printing a list of the users from this expression or making a calculated dimension?.

1 Solution

Accepted Solutions
sunny_talwar

May be this:

=Aggr(Only({$<Comment = {'a'}, UserID = E({$<Comment = {'b'} >} UserID) >} UserID), UserID)

View solution in original post

2 Replies
sunny_talwar

May be this:

=Aggr(Only({$<Comment = {'a'}, UserID = E({$<Comment = {'b'} >} UserID) >} UserID), UserID)

sigurdfjeld
Partner - Contributor II
Partner - Contributor II
Author

=if(aggr(count(DISTINCT{$<Comment = {'a'}, UserID = E({$<Comment = {'b'} >}UserID) >} UserID)

, UserID)>= 1, UserID, null())

This also works