LAG() Function for Comparison

Hey there,

I did an query where I calculated the count of created Documents based on the week. Now I’d like to compare the weekly count n with the count before n-1, the count before m-1 with n-2 and so on. I tried to use the LAG() function, but it seem as if it isn’t working with Metabase. Any suggestions?

count Dif
Week 01.03.2020 x
Week 08.03.2020 y y-x
Week 15.03.2020 z z-y

Kind regards
Ricarda

Hello,

did you find any answer to your problem? I intended to use the LEAD and LAG functions as a solution, but these do not apply to the metabase.

You would have to use those database-specific functions in Native (SQL) queries.
There’s a couple of issues open about windowing - upvote by clicking :+1: on the first post of each issue:
https://github.com/metabase/metabase/issues/12017
https://github.com/metabase/metabase/issues/9393
https://github.com/metabase/metabase/issues/8977

1 Like