Why can't I use a measure outside an aggregate context? #1666
Unanswered
jwhitaker-gridcog
asked this question in
Q&A
Replies: 1 comment
-
Really interesting suggestion. Thanks @mtoy-googly-moogly @carlineng @christopherswenson (for context). We have thought about this and currently we allow dimensions to be summed without renaming them.
I think it gives you much of what you want, though your suggestion pushes the calculation into the model. Sum is the only combinator that is allowed to use this format. Combinators .avg(), min() and max() would all need to have different names than the base dimension. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let's say I have a table of sales:
I can define a malloy source for this:
And I can define a measure for total:
However, I want to be able to use the measure
total
even if I'm not in a group by context. Intuitively this should be fine, right? (if we forget the chains of SQL for a second..) - the sum() of a single number is perfectly reasonable to take.However, if I do
i of course get
so now I need to be careful to remember to use
_total
ortotal
depending on what I'm doing (=> just like in sql).What I really want to be able to do is to define something like
And then be allowed to query
total
whether I am grouping or not. I guess this could be interpreted in a few different waysselect
it);select
. This last one is interesting, it might be (theoretically) true? count => 1, sum(x) => x, avg(x) => x, etc..?I haven't used Looker but I'm pretty sure in PowerBI and Tableau this sort of thing is straightforward - in PowerBI it would look like setting a "Default Aggregation" for a field.
Beta Was this translation helpful? Give feedback.
All reactions