Get all inactive users on Amplitude - amplitude-analytics

Using the amplitude API how can I get all users (and their amplitude_id) that have not been active in the last N days? I see that the user has the lastSeen property but it's not clear to me how to filter on it.
For example I thought maybe 'https://amplitude.com/api/2/usersearch?user=*&matches={"last_seen": "2019-01-18"}' might be along the right lines, with some modification to get last_seen less than some date, but seems not to work.
There is a more complex query set, but last_seen doesn't seem to be a valid property on it: https://amplitude.zendesk.com/hc/en-us/articles/205469748-Dashboard-Rest-API-Export-Amplitude-Dashboard-Data#query-parameters

Related

how to use datediff properly tableau

basically i have the same problem with this and use this solution too https://community.tableau.com/s/question/0D54T00000C6aS6/datediff-in-lod
so i want to count time diff between transaction for each transaction and for each users, basically my problem is just like this
same with that, ON interaction id = user id in my real data, so i want to know time different between date transaction for each users.
based on that, i made this on calculation DATEDIFF('day',LOOKUP(MIN([Created At]),-1), MIN([Created At]))
and here's the results
what makes me confuse is, why the first transaction of users always have time difference, instead it must be nothing because there's no time difference if you do first transaction, so how to make it not appear?
Create a table calc field for First
FIRST()=0
Edit the table calc so it resets ever new user id.
Now filter for False. You can remove it from Rows, I just kept it there for demo. Your calculation will still work.

aggregating in a particular order

I have a table which has columns period, value, and entity representing a set of different timeseries. I want to select entity, array_agg(value) to get the time series for each entity. However, to get the order in the array_agg correct the items need to be aggregated in order of period. I don't care what order the final output is in, as long as each array is in the right order. How can I go about this? My first pass was to use an order by period statement, but that refers to the final output rather than the order of aggregation, and errors out anyway because period is not in the group by.
This is actually pretty clearly answered in the documentation here. The correct syntax is array_agg(value ORDER BY period).

Sphinx Search Default Order

I just noticed something about Sphinx Search. If I choose a particular order, like relevance for example, it seems like if I have a number of items from 1 to 10, for some reason, the relevant returns that come back are still in a numbered order. i.e. The records will be in the 1-5 range instead of in the 6-10 range. Is there something I am missing or don't understand?
So, the only way I can get new results to show is to do a sort by ID DESC, but the problem there is I am only getting from the newest ID down and there isn't really any sort on relevance at that point.
Is there some kind of default sort on the back end that can be adjusted?

Tableau calculated field dates

I was trying to do a calculated field and I cannot get it to work right.
First I tried to duplicate what I did in access...
=DateDiff("d",[90 Days to Exp],[Expiration])
but that gives me an error
I did some research and found something that gave me valid calculations...
window_sum(datediff('day',
lookup(min([90 Days to Exp]), 0),
min([Expiration])))
that only shows 90 days which I already knew
I want to make sure it is doing a count down of days to "Expiration" so I changed it to...
window_sum(datediff('day',
lookup(min(NOW()), 0),
min([Expiration])))
also tried....
window_count(datediff('day',
lookup(min(NOW()), 0),
min([Expiration])))
still a valid calc but the numbers are way off.... I tried min and max with and without... and I still can't seem to get an accurate count down
Step back. Instead of giving us random pieces of code, explain what you're trying to achieve (what you expect as a result) and what your db looks like (for instance, what are the fields).
I'll give a solution to what I think you're trying to achieve on what I think you have as database.
I believe you have a database that each entry is a product that have an expiration date ([Expiration]). What I think you're trying to achieve is to know how many days are left until expiration date.
So, if you want to calculate this for each entry in your database, the formula should be:
DATEDIFF('day',NOW(),[Expiration])
It's very straight forward, you're calculating how many days there are between today and expiration date
I have no idea why you're using table calculations in your suggestions, but if this calculations should not be done for each entry (but rather for a collection of entries), then table calculations can be useful, but it's impossible to suggest anything if I don't understand precisely what you want

Tableau - Multiple data into one graph, with double dimension on the x-axis

I'm very new to Tableau, and (maybe because of that) struggling with a graph setting. I need to plot a simple line graph showing the ratio between the number of users that returned after registered x days ago and the total number of users that registered x days ago (regardless on the fact that they returned or not). To do this, I have two tables: TableA having (simplifying) USER_ID and DATE_REGISTRATION, and TableB USER_ID and VISIT_DATE. Both table are joined by USER_ID.
I'm able, of course, to plot each individually (i.e. count distinct of USER_ID with DATE_REGISTRATION on the x axis to get the number of new users registered per day), but not able to combine them. I guess the problem is that I'm using either DATE_REGISTRATION or VISIT_DATE on the x-axis, but in this case I can get one or the other info, but not the two combined.
Ultimately, I would like to be able to have, for each date, both the number of users visiting and the number of user who registered.
Thanks a lot in advance.
Raffaele
Well, problem is your database is not ready to generate those analysis. Your table is user_id oriented, meaning you can do lots of analysis centered on the user_id. To do date oriented you need a table like:
Date User_id Type of event
01/01/2014 1234 Registration
02/01/2014 1234 Visit
Then you can drag Date and Type of event to Columns, and COUNTD(User_id) to rows, to get a bar chart that will show, for each day, how many people registered that day and how many people visited that same day.
Additionally, you can still join this table with the one you have, to have the registration date for each user_id. That way you can, for instance, calculate how many days have passed since registration.