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.6K Product Ideas
 1.6K Ideas Exchange
 1.4K Connect
 1.1K Connectors
 286 Workbench
 4 Cloud Amplifier
 6 Federated
 2.7K Transform
 91 SQL DataFlows
 585 Datasets
 2.1K Magic ETL
 3.6K Visualize
 2.4K Charting
 642 Beast Mode
 34 App Studio
 33 Variables
 628 Automate
 159 Apps
 430 APIs & Domo Developer
 37 Workflows
 2 DomoAI
 31 Predict
 12 Jupyter Workspaces
 19 R & Python Tiles
 378 Distribute
 107 Domo Everywhere
 266 Scheduled Reports
 5 Software Integrations
 104 Manage
 101 Governance & Security
 6 Domo University
 15 Product Releases
 Community Forums
 40 Getting Started
 30 Community Member Introductions
 93 Community Announcements
 4.8K Archive