Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
Showing results for 
Search instead for 
Did you mean: 
Creator II
Creator II

Help with set analysis

Hi all!

I have a problem where I cant solve the issue in the script. I have to do it in the object it self and I thought maybe this can be solved with some nice set analysis.

I need to calculate the occurence of a transaction in the dataset. But only for specific attributes. This is an example of my data set:


TRX_Key, Dim 1, Dim 2

123, New Sales, x

123, New Stock, y

123, Old Sales, z

123, Repurchased, x

321, New Sales, y

987, Old Stock, r

987, Repurchased, s

I would like to calculate the number of times the transaction (with the TRX_key 123) with "DIM 1"="Repurchased" occurs in "DIM 1" = "New Sales" AND/OR "DIM 1" = "New Stock". In this case 2 times in total. I dont care about the occurence in "Old Sales".

Transaction with TRX_Key = 987 will be 0 times in total because it doesnt occur in "New Sales" nor "New Stock".

Any suggestion how to do this?



1 Reply


Count({<TRX_Key = p({<[Dim 1] = {'Repurchased'}>}), [Dim 1] = {'New Sales','New Stock'}>}TRX_Key)