Timeseries Value Lookup and difference in Quicksight

0

If we are storing timestamped data of sensors and values in DynamoDB or Timestream as

  • t1,odometer, 120
  • t2,odometer, 122
  • t3,odometer, 123

and so on, and would like to find out how many miles the car has driven in the last 30 days for a year, how can I do that in Quicksight/Athena and plot them in the bar graph for every month in the year?

Total miles travelled = Value(t2) - Value(t1)

Is there a way to lookup the value at a given time and take that and subtract that will value at the current time function?

jinman
질문됨 2년 전1225회 조회
2개 답변
1
수락된 답변
  1. Create a dataset to connect your Data Source I used a simple excel spreadsheet with 3 columns "date","metric","value"

Be sure to configure the 'date' column so it correctly parses your data source date formats The help on "Preparing Datasets" has advice on this Make sure the "date" column is of "Date" type (it looks like a calendar icon)

  1. Create an Analysis from your dataset
  2. Create a calculated field (in either the analysis or the dataset)
    For analysis click "Add" , "Add calculated field" The calculated field should produce "miles driven" since the previous record. I used the following formula

max(value) - lag(max(value),[date ASC],1)

The documentation for calculated fields has many examples of this. The above produces the difference between the maximum of the current time period's miles minus the maximum of the previous time periods miles.

I called my field "driven"

  1. Add (or reuse the default) visual.
    Select the chart wanted (I clicked on a column chart)
  2. Drag "date" and "driven" onto the visual
  3. Using the Field Well, select "date" and change the agragation to whatever period you want, I chose "By Month"

The result is a column graph of miles driven per month

DALDEI
답변함 2년 전
  • Hi @daldei,

    Thank you for the amazing and fantastic description. It really helped us.

    One question though: Is there any way we can get the difference of particular time in the past (like 30 days)? Is there any quick way to basically get the value 30 days ago that we can assign as calculated field?

    Again, thank you for your help!

  • Unfortunately, this solution does not help us for lag of 30 day. Any idea how we can do it? @daldei. Should we use https://docs.aws.amazon.com/quicksight/latest/user/periodToDateAvg-function.html

0
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인