We have KPI BuyerCount as B= SELECT {metric/total_...
# gooddata-cloud
k
We have KPI BuyerCount as B= SELECT {metric/total_number_of_buyers} BuyerCount Previous as B Previous= SELECT {metric/total_number_of_buyers} for PREVIOUS({label/transaction_date.year}) Some of buyer will overlap in both B & B Previous. How to fine Unique Buyer Count for B & B Previous in Metric formula.
k
New message text here
m
Hi Krishti, depending on how your data look like, it might be possible to achieve it in MAQL. Could you please help us understand: • how are you calculating the total_number_of_buyers metric? Is it some kind of COUNT of buyer_id? How does that part of your data model look like? • what do you want to calculate as the ultimate result? If this year there were buyers X, Y, Z and in previous year there were buyers W, X, Y which are those that should be included? X, Y (intersect) or W, X, Y, Z (union)? • and are you interested in just a single number (i.e. this year vs previous year) or do you want this to be dynamic i.e. displayed in a table with a row for each year? This could help write the metric.
k
Some How I resolved it.
SELECT {metric/total_number_of_buyers} for previous({label/transaction_date.year}) WHERE (Select {metric/total_number_of_orders} by {label/buyer_number}, {label/seller}) >=1
In this
Select
clause first count buyer in previous period with respect to dashboard filter. And then
WHERE
clause limit buyer who has orders in dashboard selected filter. Thanks It would have an easier if have parameter feature or dashboard filter as variable available to use in Metric MAQL.