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".