here is a general modeling question: We have a dat...
# gooddata-cloud
t
here is a general modeling question: We have a dataset “rewards”, which is connected to two timestamps: “created_at” and “confirmed_at”. A reward is “open” after it was created, but before it was confirmed. Is it possible to use just this information and create an insight that shows me a historic count of open rewards over time (e.g. as a line chart)? If yes: what do I put on the x-axis for the reference time?
m
Hi Thomas, I believe datetime diff should help with this, it would calculate the duration between the "created_at" and "confirmed_at". Otherwise, you could also preload an attribute that would save a snapshot of the reward status. More details about the mentioned query can be found here: https://www.gooddata.com/docs/cloud/create-metrics/maql/time-arithmetics/datetime-diff/
t
so far that’s clear. I can create a date diff. but still: what would I put on the x axis of the chart? it can’t be the created_at date and also not the confirmed_at date, right? E.g. on 1st of May I’d like to show a count that includes rewards that were created before 1st of May and that were confirmed after 1st of May.
m
I see where you are coming from, in that case, it wouldn't be possible to just break the metric down by either date dimension as in your source data, this calculation does not "belong" to either date. You would need an entirely new date dimension, just as you have one for when the reward is created and one for when the reward is confirmed, therefore, a date dimension that would record the snapshot of the reward status would be the best approach.
👍 1