Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
ilanbaruch
Specialist
Specialist

how to count last 30 days?


hi ,

I have a table with 3 columns:

Date 2. User_id 3. Flag_1 (0/1)

I want to create 2 new columns that will count the users with flag_1.

First one for the past 30 days (Date-30)

Second for the past 1 day (Date-1)

is someone familiar with this kind of calc.?

thank you

Ilan

6 Replies
sunny_talwar

Would you be able to share a sample?

ilanbaruch
Specialist
Specialist
Author

hi , sorry I cant attach an example. Trying to count users by flag

count unique users based on Events of Interest such as transaction (flag_1) in two ways

1. last day

2. last 30 days

thank you,

ilan

PrashantSangle

Hi,

try like

count({<Date={">=Date(max(Date)-30)<=Date(max(Date))"}>}Flag_1)

Note : Careful with Date Format. If required convert it into num and then compare.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
ilanbaruch
Specialist
Specialist
Author

thank you max,

i think Max(date)-30 will retrive the last 30 days from max date in the model or current selection.

i want to count for every day the flag count of the previois 30 (the model holds data of two years)

advanced thanks,

ilan

maxgro
MVP
MVP

It seems you want to go back 30 days for every date

Maybe here?

Calculating rolling n-period totals, averages o... | Qlik Community

ilanbaruch
Specialist
Specialist
Author

thank you very much Max. is it possible to use it with a distinct count?