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.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 737 Beast Mode
- 56 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive