Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mr_novice
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:

table1:

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?

Br

Cris

1 Reply
swuehl
MVP
MVP

Maybe

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