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:
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.