Hi All! I have a question about Date. In a usecase...
# gooddata-platform
m
Hi All! I have a question about Date. In a usecase for exemple shopping cart. I want to know how time as between user add item into cart and user proceed the order. So Example in my db I have a Cart Table with CartId, userId in the table CardProduct I have CartId, ProductId, AddedDate and table Order I have OrderID, CartID and OrderDate. I when to create a table view with
Copy code
Cart ID, Product Name, Product Added, Order Proceed, Diff Day
For start I try create a metric Select (Date (CartPRoduct Date) - Date (OrderPRoceedDate) it's is the way ?
1
m
Hi Mathieu, it depends what resolution do you need. If it is enough to have it in days then it might work this way. If you need more detailed info (hours, minutes) then it will not work because GoodData Platform only has Date resolution of days. In that case I would recommend to pre-calculate the difference (in hours or minutes) before loading to GoodData and make it fact in your dataset. Thenbyou can use the conditional formatting to convert the value to days, hours, minutes.
m
ok and the pre-calculate I can store into my db or I can create a Dataset on GoodDataSide ?
m
I assume you are using the GoodData Platform edition, (not GoodData Cloud) sonyou are physically loading the data from yoir DB to GoodData. Then it depends how you are loading it, and it can either be in your table or view. But you can not do this transformation on the fly in GoodData.
m
oki perfect, yeah I use GoodData Platform with Redshift so I can create a view is a good idea
👍 1
Thanks you!
m
BTW here is link to the documentation how to use metric formatting to convert minutes or seconds to days, hours, minutes and seconds with DIV/MODULO
👀 1
m
@Michal Hauzírek Can use Timestamp value of each date to make date diff to have secondes between to date ? If I store the unix timestamp of the date into my DB ??
m
Yes, but depending on your data model, it might require some additional expressions in your MAQL metrics. I am going to respond to you in detail in the other thread…
❤️ 1