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
 7.7K All Categories
 Connect
 918 Connectors
 242 Workbench
 476 Transform
 1.8K Magic ETL
 60 SQL DataFlows
 446 Datasets
 35 Visualize
 198 Beast Mode
 2K Charting
 8 Variables
 1 Automate
 348 APIs & Domo Developer
 82 Apps
 Workflows
 14 Predict
 3 Jupyter Workspaces
 11 R & Python Tiles
 241 Distribute
 59 Domo Everywhere
 241 Scheduled Reports
 15 Manage
 36 Governance & Security
 23 Product Ideas
 1.1K Ideas Exchange
 Community Forums
 15 Getting Started
 1 Community Member Introductions
 49 Community News
 18 Event Recordings
 579 日本支部