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.5K Connect
- 1.2K Connectors
- 296 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 614 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 729 Beast Mode
- 53 App Studio
- 40 Variables
- 677 Automate
- 173 Apps
- 451 APIs & Domo Developer
- 45 Workflows
- 8 DomoAI
- 34 Predict
- 14 Jupyter Workspaces
- 20 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 121 Manage
- 118 Governance & Security
- Domo Community Gallery
- 32 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive