Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Qlik496
Contributor II
Contributor II

How to count the transaction happened in the past 30 days from the given date.

Hello I am new to Qlik.

I want to count the transaction happened in the past 30 days from the given day for each customer.

So I tried to use this code in the sheet.

Aggr(count(distinct if( NUM(Date(REG_DATE,'YYYY-MM-DD')-30) <=REG_DATE <=NUM(Date(REG_DATE,'YYYY-MM-DD'))),TRANSID),CUSTOMER)

So this code aims to get the count of distinct transaction id (TRANSID) for every customer (CUSTOMER) for the past 30 days  from the given transaction date,(REG_DATE) 

Every data has the given transaction date as I am using the transaction data. 

Help me please.

Labels (1)
12 Replies
G3S
Creator III
Creator III

sorry I don't understand how the results were arrived at. 

this is what could work out. 

G3S_1-1692249235841.png

 

G3S
Creator III
Creator III

sorry, I don't understand how the 'result'  in your table got calculated. can you please share how TRANSID 100067 has 3 as a result against REG_DATE of 2022-10-24?

 

 this is what I was able to do so far:

G3S_0-1692257242440.png

Qlik496
Contributor II
Contributor II
Author

Okay maybe your way of counting did not included the transaction of that day. 

So I just considered 10067,10071,10072 as three because they all took place in 2022/10/24.

However, I do not want to double count 10067 eventhough it took place in 2022/9/26 and 2022/10/24.

Because this sample data has the same customer number, I want to count the distinct transactionid that occured in last 30 days from the given REG_DATE. 

Thank you for the efforts to help me. I do really count on your Qlik skills.