Beast Mode

Beast Mode

I'm stuck. Sum of a Windowed/Partitioned Sum???

I keep running into a wall with this. I think there is an easy answer, I just can't find it for the life of me.

  • My dataset contains one row per store, per day.
  • I want to display -- by region -- the count of stores with an average order value (AOV) less than $20.
  • In order to do that, I first need to calculate AOV by store for the period.

I'm having trouble understanding why this won't work:

  1. SUM(
  2. CASE WHEN (SUM(`Revenue`) / SUM(`Transactions`)) < 20 THEN 1 ELSE 0 END
  3. ) OVER (PARTITION BY `Store`)

I have also tried multiple iterations of this, to no avail:

  1. COUNT(
  2. CASE WHEN
  3. SUM(SUM(`Revenue`) FIXED (BY `Store)) / SUM(SUM(`Transactions`) FIXED (BY `Store`))
  4. < 20 THEN 1 END
  5. ) OVER (PARTITION BY `Region`)

Here is a mockup in Excel, with yellow to represent beast modes.

image.png


Answers

Welcome!

It looks like you're new here. Members get access to exclusive content, events, rewards, and more. Sign in or register to get started.
Sign In