Fixed Function Problem
Hello, I have an issue that I'm working through in which I want to essentially group by two columns and find the average rank in that grouping. I then want to filter this rank to be less than 3 and count the total rows from this. All in a beastmode. The SQL behind this looks like the following:
SELECT Count(*) from
(SELECT keyword, company, avg(rank) as average_rank
FROM data
GROUP BY keyword, company
HAVING average_rank <= 3)
WHERE company = 'CompanyA'
I want to take that number that I get and essentially divide it by the total rows shown by the below SQL (please note it is the same code as above but just without the final where clause):
SELECT Count(*) from
(SELECT keyword, company, avg(rank) as average_rank
FROM data
GROUP BY keyword, company
HAVING average_rank <= 3)
Therefore, the progression of the data would look something like this:
which then with the group by would look like this:
then with the having clause would look like this:
and finally with the first code, I would get just one row and the second sql code I would get 2. So I want a final number of 50%. I want to be able to do this all in a beastmode so it is wholly dependent on what the user will filter on.
The beastmode that I got closest on is:
count(case when AVG(blended rank
) fixed (by Keyword
,Company
) <= 3 then 1 end)
I then can filter company in the card level filter. I can't put the filtering of the company in the beastmode (from what I have seen) because it always leads to an error.
I then tried to have the company filtered in the card level and to have the second number look like this in the beastmode:
sum(case when AVG(blended rank
) fixed (by Keyword
,Company
FILTER NONE) <= 3 then 1 end) so that the filtering of company didn't work on this number (but it doesn't in this case).
Please help!
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
- 755 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 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