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
已提问 1 年前67 查看次数
没有答案

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则