Hi all, I'm trying to make a bar chart that plots ...
# gd-beginners
k
Hi all, I'm trying to make a bar chart that plots effectively a metric versus a metric (which doesn't seem possible but not sure if there are alternatives?) I have a facts table that counts the number of purchases made by a user each day. I want to assign each user to a bin based on the number of purchases they made in my date range, and count (so each bar should have a height based on the number of users with that many purchases). I want to do this dynamically because I want to change the date range and have it update (e.g., in the last 30 days, or in the last 90 days). Is this possible in Gooddata and if not what's the general convention for implementing it? This feels like a common use case but feels like I have to do almost everything at the warehouse level
👀 1
m
Hi Kraig, I understand you want to achieve that using Column chart, but is not the same you want to achieve with the Heatmap chart? please see my example. There are customers from my dummy data, Date granularity that can be changed (I used month) and in each 'bin' is the number of purchases that each customer made.
k
For the heatmap, you can only drag dates/attrbitues into the rows and columns (similar to the bar chart), so I couldn't do "Number of purchases" versus "Number of people with that many purchases", even though both will be integers
m
Hi Kraig, if I understand correctly that you want a dynamic bar chart where for example: X-axis (binned metric): Ranges of purchase counts (e.g
0–4
,
5–9
etc.) Y-axis (count): Number of users that fall into each range Perhaps you can define individual MAQL metrics: - Users with 0–4 purchases
Copy code
SELECT COUNT(User ID)
WHERE (SELECT COUNT(Purchase ID) BY User) BETWEEN 0 AND 4
- Users with 5–9 purchases:
Copy code
SELECT COUNT(User ID)
WHERE (SELECT COUNT(Purchase ID) BY User) BETWEEN 5 AND 9
And so on - Then create a bar chart with each metric as a series/bar and this would be fully dynamic with date filters.
k
That's brilliant! Thanks @Michael Ullock
👍 1