Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
M_Zaki
Contributor III
Contributor III

count transactions happened on the same month of user creation

 

Based on below data, i need to develop two measures:

- to count distinct transactions "Tx_ID" which its "Tx_UPDATE_DATE" month/year equal to "User_CreateDate" month/year, and it's amount not equal 0.

- to count distinct transactions "Tx_ID" which its "Tx_UPDATE_DATE" month/year after "User_CreateDate" month/year, and it's amount not equal 0.

Note: the dimension will be "month/year".

Capture.JPG

 

2 Replies
OmarBenSalem

In ur script, in the table where u have these fields; create a FLAG

if(Tx_Amount>0

and Year(Tx_UPDATE_DATE) = Year(User_CreateDate)

and Month(Tx_UPDATE_DATE) = Month(User_CreateDate), 'Measure1',

if(

Tx_Amount>0 

and Tx_UPDATE_DATE>User_CreateDate

and Month(Tx_UPDATE_DATE) <> Month(User_CreateDate), 'Measure2'

)) as FLAG,

 

Now : 

 to count distinct transactions "Tx_ID" which its "Tx_UPDATE_DATE" month/year equal to "User_CreateDate" month/year, and it's amount not equal 0:

count(distinct {<FLAG={'Measure1'}>}Tx_ID)

- to count distinct transactions "Tx_ID" which its "Tx_UPDATE_DATE" month/year after "User_CreateDate" month/year, and it's amount not equal 0.

count(distinct {<FLAG={'Measure2'}>}Tx_ID)

M_Zaki
Contributor III
Contributor III
Author

Thanks Omar,
i applied something like this, but without editing loading script