How to create simple tables with both variables created in beast mode, using window functions
Hi,
I am trying to partion by a beast mode and then creating a table based to provide an overview of how many agents fall into a certain quadrant.
1. I created a beast mode that places each customer into the scatterplot based on the two score I defined:
advisory score= sum(case when product='nx' then 'score' else 0) / sum(case when product='nx' then 1 else 0)
sales ratio=sum(sales)/sum(attempts)
2. I created another beast mode variable that determines which quadrant they fall in:
case when (
sum(case when product='nx' then 'score' else 0) / sum(case when product='nx' then 1 else 0))>0.5 and
(sum(sales)/nullif(sum(attempts))),0)) >0.4
then 'Q1' else
(case when (
sum(case when product='nx' then 'score' else 0) / sum(case when product='nx' then 1 else 0))>0.5 and
(sum(sales)/nullif(sum(attempts))),0)) <=0.4
then 'Q2' else
(case when (
sum(case when product='nx' then 'score' else 0) / sum(case when product='nx' then 1 else 0))<=0.5 and
(sum(sales)/nullif(sum(attempts))),0)) <=0.4
then 'Q3' else
(case when (
sum(case when product='nx' then 'score' else 0) / sum(case when product='nx' then 1 else 0))<=0.5 and
(sum(sales)/nullif(sum(attempts))),0)) >0.4
then 'Q4'
end) end) end) end
3. I am trying to get a simple table like in the attachement using the HTML Table.
But when I drag the variable I created in 2 into columns and also drag count of agents it all just collapses to one row (attached in 2nd pic) and counts the row entries.
Any idea how to solve that??
Any help is much appreciated!
Comments

Hi @user084060
I'd recommend simplifying your beast mode so you don't have so many nested case statements. You can have multiple WHEN statements in your when clause. You don't need to create a new case statement in each else clause.
Try something like this:
case when (sum(case when product='nx' then `score` else 0 end) / sum(case when `product`='nx' then 1 else 0 end))>0.5 and (sum(`sales`)/nullif(sum(`attempts`))),0)) >0.4 then 'Q1' when (sum(case when product='nx' then `score` else 0 end) / sum(case when `product`='nx' then 1 else 0 end))>0.5 and (sum(`sales`)/nullif(sum(`attempts`))),0)) <=0.4 then 'Q2' when (sum(case when product='nx' then `score` else 0 end) / sum(case when `product`='nx' then 1 else 0 end))<=0.5 and (sum(`sales`)/nullif(sum(`attempts`))),0)) <=0.4 then 'Q3' when (sum(case when product='nx' then `score` else 0 end) / sum(case when `product`='nx' then 1 else 0 end))<=0.5 and (sum(`sales`)/nullif(sum(`attempts`))),0)) >0.4 then 'Q4' end
It's combining it into a single row because your beast mode is only returning Q1. If the updated beast mode continues to return only Q1 I'd recommend you create beast modes (if you haven't already) with the formulas for your advisory score and sales ratios, toss them onto your table and see if you get other values besides ones that would cause them to fall into the Q1 bucket.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 
I recoded my Quadrant formula as you suggested, but unfortunately it is still collapsing to Q1 and the row count when just create a view that shows how many agents fall into each quadrant.
I attached the table and as you can see all of my variables are created in beast mode. My question now is, is it still possible to create the view I described with my current set up?
0 

What you're asking for is not possible without preaggregating your data in ETL or a dataset view.
What you described is wanting your ratio calculated at one row per customer SUM(...) / SUM(...)
To do that you had to put Customer on the Axis.
But you don't want one row per customer you want groups of the ratio (hence the CASE statement).
To get rid of each customer ,you took it off the axis. But then the ratio, SUM(...) / SUM(...) , recalculates at the granularity of the card which is ... All customers.
This is why you're getting just one row.
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"0
Categories
 All Categories
 1.7K Product Ideas
 1.7K Ideas Exchange
 1.5K Connect
 1.2K Connectors
 292 Workbench
 4 Cloud Amplifier
 8 Federated
 2.8K Transform
 95 SQL DataFlows
 601 Datasets
 2.1K Magic ETL
 3.7K Visualize
 2.4K Charting
 691 Beast Mode
 43 App Studio
 39 Variables
 658 Automate
 170 Apps
 441 APIs & Domo Developer
 42 Workflows
 5 DomoAI
 32 Predict
 12 Jupyter Workspaces
 20 R & Python Tiles
 385 Distribute
 110 Domo Everywhere
 269 Scheduled Reports
 6 Software Integrations
 112 Manage
 109 Governance & Security
 8 Domo University
 25 Product Releases
 Community Forums
 39 Getting Started
 29 Community Member Introductions
 98 Community Announcements
 Domo Community Gallery
 4.8K Archive