Hi everyone,
I want to do a distinct count of users that have:
1) Logged in at least once a month AND
2) They've done this in the last 3 consecutive months.
So if they logged in only during one or two of the three months, it won't count them.
Thanks!
Provided you have month field extracted from your results
.. | stats dc(month) as Month_Count values(month) by USER | where Month_Count > 3
@sharonmok, what are the month and user fields in your query. How do you identify Login attempt? Do you need to count only successful login or failed one as well? Can this be identified based on your data?
If you can add sample data and current query that you have tried, it will help us assist you better.
This is what I had originally:
| dedup user_company, date_month
| stats count(user_companyname) as client_count
| eval A = (client_count /100) * 100
| table A
The last two lines were just to make it into a percentage out of the total number of users. Login attempt is just if they show up in the logs. No need to count the ones that didn't log in.
Thanks!
@sharonmok
You need to give a alias name.
Try the below query..
| stats dc(Month) as Month,list(Month) as Months,values(Month) as Monthss by User
| where Month>=3
| table User Month Months Monthss
Regards,
Shankarananth T
Provided you have month field extracted from your results
.. | stats dc(month) as Month_Count values(month) by USER | where Month_Count > 3
Thanks for your reply! I'm getting a 'dc' function is unsupported in 'where' command.
That's why it is best practice to ALWAYS rename aggregate fields.
| stats dc(month) as DCmonth values(month) by USER | where DCmonth > 3
Thank you! This did exactly what I wanted it to!
I agree, should always rename aggregated fields. I posted this in rush. I'll fix the answer.