How do I get the following aggregation setup in domo?
I have a dataset as follows: and I want the aggregations as shown below (number sum is just the sum aggregation of column 'number'
the first table is the actual data and the next three tables are the aggregations I want in the same sheet (i.e. the user should be able to add/remove the columns on their own and see those values).
I have tried using fixed level of details but couldn't quite get it to work.
Best Answer
-
First, how to get those aggregations (no formula needed):
You could set up a table card with two columns,
id
andnumber
. If you select "sum" for the aggregation for that field, it will show the sum perid
. Then you could have a second table card withlist
andnumber
and a third with justnumber
. To match your question, I said to use a table card, but this is the same logic for most of the viz cards (bar graphs, etc.)Second, if instead of three separate cards, you want a single card where a user can switch between the different aggregations:
Set up a variable with three options, 'id', 'level', 'total'. Then create a beast mode like:
CASE
WHEN
variable
= 'id' thenid
when
variable
='list' thenlist
when
variable
='total' then 'Total'END
Note that the final 'Total' is just an arbitrary constant, it could be anything.
Then you make a table with that Beastmode you created and your
number
column, and you can add a control to your page using the variable you created.Here's the overview of variables to reference:
Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
1
Answers
-
First, how to get those aggregations (no formula needed):
You could set up a table card with two columns,
id
andnumber
. If you select "sum" for the aggregation for that field, it will show the sum perid
. Then you could have a second table card withlist
andnumber
and a third with justnumber
. To match your question, I said to use a table card, but this is the same logic for most of the viz cards (bar graphs, etc.)Second, if instead of three separate cards, you want a single card where a user can switch between the different aggregations:
Set up a variable with three options, 'id', 'level', 'total'. Then create a beast mode like:
CASE
WHEN
variable
= 'id' thenid
when
variable
='list' thenlist
when
variable
='total' then 'Total'END
Note that the final 'Total' is just an arbitrary constant, it could be anything.
Then you make a table with that Beastmode you created and your
number
column, and you can add a control to your page using the variable you created.Here's the overview of variables to reference:
Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
1 -
But if I select the 'id' column, I want to sum for user-1 to be 5 and not 10(essentially the max of the values across both the lists for a user). If I just take sum aggregation directly, the result with be 10 for the first user and 20 for the second user but I have 5 and 10 respectively.
0 -
That's a bit different. It's not a simple sum, but the sum of the max value by user. That would require a fixed function (
) that could look like this:sum(max(
number
) fixed(byid
))You could still either make 3 cards or create a variable that allows a user to flip between the 3 levels of aggregation.
Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
1
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