10 Oct 2024 06:05 PM
Hello, everyone!
I have a metric that stores each new purchase of a customer. The problem is that, if the customer buys 3 items, I have 3 values in my metric.
So I stored the orderid as dimension.
With a single value I got:
timeseries `beta-orders` = sum(`log.beta-orders`), by: {step, orderid}
| filter step == "Booking"
| summarize count = countDistinct(orderid), by: {step}
but now I need a graphical view, counting how many unique orderids were generated
Is it possible to use MakeTimeseries with CountDistinct?
10 Oct 2024 06:36 PM
You may be able to use the "dedup" command instead of summarizing, which would leave your data in a timeseries for charting.
timeseries `beta-orders` = sum(`log.beta-orders`), by: {step, orderid}
| filter step == "Booking"
| dedup orderid
10 Oct 2024 06:43 PM
unfortunately it didn't work. From what I saw, the orderid column, the values are not repeated, the problem is in the array that quantifies the values
10 Oct 2024 07:00 PM
The only way I can see to do it is to just append the same timeseries with the summarize so you'll end up with one value for the distinct count but also have the timeseries data. This doesn't make the data suitable for a chart, however.
If you're trying to display this on a dashboard you may consider a single value tile that contains the summarize command with the number of orderids beside a chart of the timeseries data.
11 Oct 2024 07:40 PM
If you say: "The problem is that, if the customer buys 3 items, I have 3 values in my metric", does it mean that you have also something like "itemId" as dimension of this metric?
I see that this metric is defined as a metric from log. Can you share your metric definition?