Struggling with a very Simple MAQL Query I have t...
# gd-beginners
d
Struggling with a very Simple MAQL Query I have this table. It joins on our "Main" table on the case_interaction_id. All I want to do is count the number of times Feedback = "Positive" PER Topic. Which are in the same table. I created a simple SELECT SUM(SELECT CASE WHEN {label/feedback} = "Positive" THEN 1 ELSE 0 END) However, when I do the Topic dimension is hidden. I tried using BY ALL OTHER (not 100% clear what it does) by that didn't work either. I don't understand why its hiding it when they are in the. same table.
m
I believe something like this will work:
SELECT COUNT({dataset/call_topics}) WHERE {label/feedback}="Positive"
In your original metric, I think the calculation engine might get confused by the CASE and constants 1 and 0 as it does not have dimensionality for them. Unlike in SQL where you work directly with columns that exist in tables, MAQL works with attributes and dimensionality and the very same attribute might exist in multiple datasets. Maybe in your original metric it would need some hint like “`BY {dataset/call_topics})`” but I think the simpler metric with WHERE will be also faster to compute.
d
@Michal Hauzírek I did already try "BY {dataset/call_topics})" already and I got the same result. Also Feedback and call_topic is only in one table. I will try to count by a dataset, I have not seen that before