Calculating the time difference between current record and one immediately preceding it by user in Quicksight

0

For each record, I would like to calculate the time difference between that record date and the most recent previous record for that user. The goal is to calculate the number of days between user logins.

I was able to identify the last action date using the lag function:

Date of Previous Action (Tenant) = lag({action date [master]}, [{action date [master]} ASC], 1,[{tenant [master]}])

I think calculated the number of days between the current action and the previous one:

dateDiff({Date of Previous Action (Tenant)},max({action date [master]}),"DD")

I then obtained the following results:

Enter image description here

I am looking for a way to assign the number of days between actions for that user to each record, but I cannot figure out a way to do this. Does anyone have any suggestions?

Thank you so much in advance!!

  • You can try the formula timediff = LAG([timestamp], 1) - [timestamp] This formula calculates the time difference by subtracting the value of the timestamp column in the current row from the value of the timestamp column in the previous row. Add the calculated field to your QuickSight visualization. Use the calculated field to show the time difference between the current record and the one immediately preceding it.

JNiles
demandé il y a un an65 vues
Aucune réponse

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions