I’m using the following calculated field formula to determine if each customer in a given month is a repeat customer (has purchased in the past 3 months), a reactivated customer (hasn’t purchased in the past 3 months, but has prior to that) or a new customer.
ifelse(isNull(lastPurchaseMonth),'New', ifelse(lastPurchaseMonth >= addDateTime(-2, "MM", truncDate("MM", max({updated_at}))), 'Repeat', 'Reactivation'))
The calculated field seems to be working well and I can generate a table that looks like the following:
Column 1 | Column 2 | Column 3 | Column 4 |
---|---|---|---|
Dec 2023 | Customer 1 | Repeat | |
Dec 2023 | Customer 2 | Repeat | |
Dec 2023 | Customer 4 | New | |
Nov 2023 | Customer 1 | New | |
Nov 2023 | Customer 2 | Reactivation | |
Nov 2023 | Customer 3 | Repeat |
I want to put this in a vertical stacked bar chart so that I can easily see how many total unique customers we had each month and the breakdown between repeat, reactivations, and new customers. When I put the month as the x axis, customer as the value, and try to drop my calculated field in the group/color, it says “Custom aggregation field is not allowed as a dimension”. Is there any way around this to create the visualization I’m trying to create?