Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, i have this example data:
product amount timestamp SNr
a 30 01.01 10
b 40 01.01 10
a 30 01.01 12
b 50 01.01 12
a 30 02.01 11
b 25 02.01 11
etc...
i want to make a histogram that sums the amounts of each product (later it should be possible to filter out products).
Ex: 70, 24, 22 etc.
The histogram should show the frequency of each sum
My idea is
=aggr(sum(amount), timestamp, SNr, product )
why dosent this work?
I don't know that this is possible with a histogram. They are usually meant for looking at the distribution of values in a given field. You would need to create a field that had the summed amounts grouped by timestamp and SNr (ignoring product) but also they need to remember which part of the summed amount was associated with which product. I may be missing something, but I don't think this is possible.
I was able to approximate what I think you are looking for with a bar chart.
This bar chart has aggr(sum(amount), timestamp, SNr) as the dimension and count(aggr(sum(amount), timestamp, SNr)) as the measure. I then changed the settings of the x-axis to use a continuous scale:
Do you need to aggregate the sum across all those fields? When I create a histogram with just "amount", I get the following:
The data used is shown in the table. Will this work? If not, could you clarify your requirements a little. What data do you want to see the distribution of?
no, for example: for SNr 10 and timestamp 01.01: a + b = 30 + 40 = 70 etc.
sql : SELECT date(timestamp) as datetest, SNr, SUM(amount) as sumamount
FROM table
GROUP BY date(timestamp), SNr
i cant use this because i want to be able to filter the data by product
I don't know that this is possible with a histogram. They are usually meant for looking at the distribution of values in a given field. You would need to create a field that had the summed amounts grouped by timestamp and SNr (ignoring product) but also they need to remember which part of the summed amount was associated with which product. I may be missing something, but I don't think this is possible.
I was able to approximate what I think you are looking for with a bar chart.
This bar chart has aggr(sum(amount), timestamp, SNr) as the dimension and count(aggr(sum(amount), timestamp, SNr)) as the measure. I then changed the settings of the x-axis to use a continuous scale:
thanks that works, but for some reason i was getting a lot of 0 in dimension. I have fixed it with an "if". Do you have any idea what could i be getting zeros?
I can't say for sure without knowing more about the data. Could you share a sample of the data that produces 0s?