Open ChloeBellm opened 1 week ago
Thanks for a very elaborate question @ChloeBellm 🙌
A couple of points here:
I hope this helps.
Thanks @igorlukanin! Good to hear this is on the roadmap.
How would running a query with fewer dimensions work if we want to apply measure filters at the dimension breakdown the user has selected?
For example, if we have some data: A | B apple | 20 orange | 30
Where A is a dimension, and B is a "sum" measure.
First query asks for dimension A and measure B with a filter on B > 25 and this returns just orange. The total we'd like to show is therefore 30. The second "totals" query would just ask for B with the same filter for B > 25? If we did this the filter would perform a check of 50 > 25 which is true so it would return 50 as the total, which is not correct.
Please let me know if I should open a new issue for this question.
@ChloeBellm Oh, I see now. You have a measure filter, and this basically renders my "less dimensions" workaround useless.
How do you plat to consume the data? It looks like you might need to calculate totals on the client side then—until we get either multi-stage cals or window functions support in Cube Store.
@igorlukanin we want to show users a table of data and a totals row. The main challenge is with calculated measures as we have measures that are one dimension divided by the other, for example, so to calculate this client side we'd have to specify how those calculations should work. We had actually done this previously but we have many metrics and defining the logic for those in two places is not ideal! We also use Cube's pagination which means the total in the data returned wouldn't necessarily be the whole total. Another idea I had was to join a separate Cube with FILTER PARAMS, but I'm not sure I can see how this would work with pre aggregations?
Describe the bug I think this is a bug based on the error message but if this isn't supported would love to hear workaround suggestions as this is currently preventing us from using pre aggregations.
I'm expecting to create a pre aggregation with column A. I then want to query column B, which is a measure based on a window function on A but get the following error:
The use case for this is to get a "totals" row, so my window function is just
sum(sum(A)) over ()
To Reproduce Steps to reproduce the behavior:
This is correct but throws the error above.
Expected behavior I expected it to run the SQL query above and give me a total column as column B.
Example expected output: A | B 1 | 12 3 | 12 8 | 12
Where B is the total of everything in column A. We should assume filters have been applied, which is why this needs to be calculated after pre aggregations created.
Screenshots Error on playground:
Minimally reproducible Cube Schema
Version: 0.36.7
Additional context If there are any other suggestions as to how to do totals (and sub totals) we would love to hear these too!