Hey everyone, struggling with MAQL a bit, seems li...
# gd-beginners
h
Hey everyone, struggling with MAQL a bit, seems like everything i’m trying doesn’t quite work the way i thought it would, trying to write the MAQL equivalent of the following SQL as a metric
Copy code
select count(*)
from (
      select email, SUM(hours) as total
      from user_hours
      where date between '2022-05-01' and '2022-07-01'
      group by email
) as t
where t.total > 10
;
I tried to do
Copy code
SELECT ... BY ... WHERE SUM(...) > 10
but it seems the
SUM(…)
aggregates all values in the dataset, not across the slices, i also tried a
SUM(…) … WITHIN
but i need the count of records
m
Hi Hunger, I am not sure I understand the goal of the metric you want to build, but have you tried simplyfing it, and then applying filters to the insight directly instead? E.g.: Filters in the GoodData Platform - Gooddata Free
h
hey moises, i figured out a way of getting it to work, i simplified it quite a bit and did what you said + called one metric from another to mimic a sub-query
thanks 😄
m
Glad to hear! 🙂
h
whiel i got ya, i tried to use
ISNULL(metric, 0)
with no luck, is there anyway to return 0, when there’s no data?
m
We also have a free MAQL course in our University in case you are interested: https://university.gooddata.com/getting-started-with-maql
h
oooh that class is next on my list once i get this out the door… 😄
👍 1
m
This Community post can help with your new question: https://community.gooddata.com/metrics-and-maql-57/null-column-529
h
excellent thanks 😄
🙌 1