Is there a way to do a level of detail calculation?

3 followers
0
Avatar

I am trying to perform a level of detail calculation similar to the functionality available in other tools. My goal is to sum an entire column of a sheet and display that as a repeating value on each row of a column.

Here is an example of my intended goal. I know I could create a 2nd sheet in my workbook to groupsum my spend into one cell, but then I am not able to join it back up because there is no field to join on

Thanks in advance for the help!

Jared Oeth

8 comments

  • Avatar
    Alan Mark

    Hi Jared,

    If you're doing a GROUPBY on any column (I'm betting you're GROUPBY on the customer column) you're going to need a new sheet.  My first instinct is to create the new sheet with a column containing the formula "GROUPBY(1)".  Then use the COPY formula to copy the results from your previous sheet into the new sheet.  This will group all your data into a single group, while keeping the GROUPBY order from the previous sheet.  Then you can do a GROUPSUM, and it will sum all the values together as I think you want while also retaining the rest of the data.

    Let me know if that doesn't get you moving forward!

     

    1
  • Avatar
    Alan Mark

    Hi Jared,

    COPY is not quite like just putting in the reference for the column.

    You'd want COPY(#Sheet!Column).

    This creates a copy of the data, including the current order, while not maintaining the group aggregation/series requirements.  The issue is you can't use a group aggregation function on the same page as a group series function(with the exception of a single GROUPBY).

    When you simply reference the column from the other sheet in the manner you are currently - you maintain these requirements.

    Alan

    1
  • Avatar
    Alan Mark

    Jared, 

    Do the summation on the column from the new sheet, not Sheet2.

    You need to break all direct references to the original sheet.

     

    1
  • Avatar
    Joel Stewart

    An alternative approach overall is this one: 

    1. Add a column to your current sheet (I'll call this "Sheet1") that has a static String value of "Key".
    2. Sheet1 now has columns: Customer, Spend, "Key"
    3. Add a new sheet (I'll call this "Sheet2") with two functions: GROUPBY(Sheet1!Spend) and GROUPSUM(Sheet1!Spend)
    4. Sheet2 now has columns: Key, TotalSpend (and should have just 1 row since "Key" is static in Sheet1)
    5. Create a Join between Sheet1 and Sheet2 using the "Key" column as the Join criteria.
    6. The resulting Join Sheet should have columns: Customer, Spend, "Key", TotalSpend (from the GROUPSUM function in Sheet2)
    1
  • Avatar
    Jared Oeth

    Hi Alan Mark,

    Thanks for the quick response! This doesn't seem to be working yet.

    My Customer and Spend columns above are just regular fields (not groupby or anything) yet. I created another worksheet (named Sheet2) to do groupby(customer) and groupsum(spend) which aggregates the spend at the customer level - same results as before since it was one record each, but using the group functions.

    On Sheet1, I have groupby(1), Sheet2!#customer, Sheet2!#spend, groupsum(Sheet2!#spend) and am getting an error.

    The part that I'm not understanding is where you say to use the "COPY fomula to copy the results from previous sheet". Is that different than what I outlined?

    Thanks again for your help.

    0
  • Avatar
    Jared Oeth

    Oh interesting, I hadn't used that function before.

    So for my columns, I now have...

    • On sheet2, I have GroupBy(#souce!Customer) | GroupSum(#source!spend)
    • On Sheet1, I have GroupBy(1) | COPY(#Sheet2!Customer) | COPY(#Sheet2!Spend) | GroupSum(#Sheet2!Spend) 

    The final column groupsum(#sheet2!spend) is giving the same error as the last image of "#Sheet1!Total_Spend: Must be a group series function"

    0
  • Avatar
    Jared Oeth

    I'm sorry - I feel like I am being completely dense and missing the point.

    My groupsum is now referencing the copy column that is on its own page.

    0
Please sign in to leave a comment.