Window function over() partition by

Hi guys,
Im trying to do this in metabase: a count of number of employees in a department and a region. It doesn’t seem to work.

Hi @Pinta
Which version of Metabase?
And which database are you querying?

Im just playing around with the metabase sample dataset. Metabase version: 0.32.9, the latest.

Im trying with: select ID, USER_ID, count(*) over(partition by USER_ID)
from ORDERS

on this table:

@Pinta
The Sample Dataset uses H2 as the database, so you need to matching grammar:
http://www.h2database.com/html/grammar.html#window_name_or_specification
It might be easier to play with Postgres or MySQL?
There’s work being done to support windowing via the interface, but I don’t think it will make it in 0.33

1 Like

Thank you. The link is very helpful.

Hi @flamber :slight_smile: is it possible to use SUM() OVER (PARTITION BY ) in metabase?

@Helena You can do almost anything in SQL - but windowing isn't available in the GUI.
https://github.com/metabase/metabase/issues/9393 - upvote by clicking :+1: on the first post

1 Like