Aggregations on Individual "Grouped By" Fields AND Showing the records within each group

I would like to see a feature which allows aggregate functions to be done on “Grouped By” fields while ALSO allowing the ability to see each of the records within each group in the result of the query (Raw Data)

My use case is a view which consists of all courses taken by all students at a school. There is a record for every course that every student has ever taken.

For example, let’s say I want to see all the courses of each individual student, the number of credits the student has earned in that course, and THEN the total number of credits that student has earned in general (it could either display on every single record or once per student).

Hi @Blake
If I understand your request correctly, this will be possible in the upcoming 0.33 with the new query browser.
Read more about it: https://metabase.com/blog/a-query-for-your-thoughts/index.html

Hey flamber. Thanks for the reply.

I am now in the .33 beta trying to do this. However, I am still not able to do this. Basically what I want to do is the equivalent of a window function in postgres like the following:

SUM (creditsearned) OVER (PARTITION BY studentid)

Which would give results that look like this
studentid, coursename, creditsearned, totalcreditsearned
123, physics, 1, 3,
123, math, 0, 3,
123, reading, 1, 3,
123, history, 1, 3,
124, physics, 0, 0,
124, reading, 0, 0,

…If that makes sense

@Blake
Windowing functions are being worked on, but I don’t think they will make it in time for 0.33 - more likely 0.34

Okay, thanks!

Any ideas of when .34 would be released?

0.33.0 is maybe a couple of weeks away, and because it’s a major change of the interface, then I would expect a few minor releases after that before 0.34 might be worked on.

Awesome. Thanks for all the help! Are you one of the head developers for Metabase?

@Blake No, I’m just helping out in the forum and trying to triage the issues.

1 Like