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
asked a year ago65 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions