Pivot table: Change Subtotal to Average
Hi everyone,
I am facing a problem of presenting averages as the 'Subtotal' instead of the sum as subtotal in pivot table. The following picture is the context of this issue:
The columns are working days and the rows are monthly data for shop 1,2,3….
The source data is daily data. However, for this table, each cell is filled with the calculated sales growth rate for each month. For example, Jan-23 Shop 1's growth rate is calculated as: ( sum(Sales in Jan 2023) - sum(Sales in Jan 2022)) / sum(Sales in Jan 2022).
For the subtotal row, I want to show the average of the Growth Rate for all Monday's instead of sums.
The growth rate calculation is written in Beast mode. I read from some domo expert saying that if the beast mode is written in Average, then the 'subtotal row' will be average too. However, what I am calculating is a growth rate, so does anyone know how can I show average numbers to replace the sum numbers?
Thank you in advance for the help.
Best Answers
-
This might be able to be achieved using a FIXED function in your Beast Mode. Here's the documentation for FIXED functions in Beast Modes:
It would probably look something like this:
AVG((sum(Sales in Jan 2023) FIXED (BY Shop) - sum(Sales in Jan 2022) FIXED (BY Shop)) / sum(Sales in Jan 2022) FIXED (BY Shop))
I haven't tested this, you'll likely have to play around with the functions a bit to figure it out.
Was this comment helpful? Click Agree or Like below.
Did this comment solve your problem? Accept it as the solution!0 -
I don't think so, but maybe someone else knows better than I do. Domo only allows one aggregation level, and two when using FIXED. You can try to change the options for that column at the top (where you normally format the value), and see if you can change the total option to SUM. But, I'd assume that would cause three levels of aggregations and would make the card fail.
Was this comment helpful? Click Agree or Like below.
Did this comment solve your problem? Accept it as the solution!0
Answers
-
This might be able to be achieved using a FIXED function in your Beast Mode. Here's the documentation for FIXED functions in Beast Modes:
It would probably look something like this:
AVG((sum(Sales in Jan 2023) FIXED (BY Shop) - sum(Sales in Jan 2022) FIXED (BY Shop)) / sum(Sales in Jan 2022) FIXED (BY Shop))
I haven't tested this, you'll likely have to play around with the functions a bit to figure it out.
Was this comment helpful? Click Agree or Like below.
Did this comment solve your problem? Accept it as the solution!0 -
@bryced Thank you very much for your comment and solution. The average works by adding both Day and Shop column in the fixed by function. However, both row subtotal and column subtotal are showing the average.
Is there any way to have subtotal row as average but total column as the aggregated sum?
0 -
I don't think so, but maybe someone else knows better than I do. Domo only allows one aggregation level, and two when using FIXED. You can try to change the options for that column at the top (where you normally format the value), and see if you can change the total option to SUM. But, I'd assume that would cause three levels of aggregations and would make the card fail.
Was this comment helpful? Click Agree or Like below.
Did this comment solve your problem? Accept it as the solution!0 -
Thank you for your answer. I tried and I also can't make it work. Maybe this is a DOMO limitation.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive