Magic ETL

Magic ETL

Dividing Two Grouped Columns

Contributor
image.png

How do I divide two columns that are grouped? The Revenue Column is taking the sum of all revenue for each D9-THC bucket. The same applies to the Quantity Sold Column. However, the Days column takes the distinct count of days where these products were sold. I would like to create a new column "Revenue Per day" that divides revenue by the days column. How can I do this while retaining the ability to filter by date, and have all my values and the newly calculated field change?

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

Best Answer

  • Coach
    Answer ✓

    @nmizzell A beast mode calculation would be your best bet since the calculation will update based on whatever filters are selected. The formula should look something like this:

    1. sum(`Revenue`)/count(distinct `Date`)

Answers

  • You can use a beast mode for this

    1. SUM(`Revenue`) / SUM(`Days`)

    You can use the same aggregation and logic for the revenue and days

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • Coach
    Answer ✓

    @nmizzell A beast mode calculation would be your best bet since the calculation will update based on whatever filters are selected. The formula should look something like this:

    1. sum(`Revenue`)/count(distinct `Date`)
  • Contributor

    Thank you! This worked.

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