distinct count of concat (column) , row_number over partition by (column) - Why isn't this working?
Good morning
I'm curious if anyone has any insight into why this beastmode doesn't work, because if I could get this to work, it would solve a lot of work for me.
The beastmode that doesn't work for me is: COUNT(DISTINCT ( CONCAT(`hs_rpt_drivemaster.driveid`,'',row_number() over (partition by `hs_rpt_drivemaster.driveid`))))
It works up to the point that I add the count distinct function in
Meaning this works fine: row_number() over (partition by `hs_rpt_drivemaster.driveid`)
And this works fine: CONCAT(`hs_rpt_drivemaster.driveid`,'',row_number() over (partition by `hs_rpt_drivemaster.driveid`))
But once I try to count this Distinct Concat count, I get the dreaded "An issue has occurred during processing. We are unable to complete this request"
The reason I am trying to do a row number partitioned by "DriveID" is that DriveID's can have a 1st shift and a 2nd shift, creating 2 rows. However, we have no unique identifier of 2nd shifts, and not all drives have 2nd shifts. I am wanting a distinct count of shifts, not drives. So I was trying to do distinct count of concat ([driveA],[rownumber])
I have attached a snapshot of an example spreadsheet for a visual
Best Answer
-
Hi @HashBrowns
Domo doesn't like it when you try and take an aggregate (count) of another aggregate (row_number). There's some caveats to this with window functions but how you're utilizing this is why.
What I'd recommend you do is create a new Magic ETL (or a Dataset View if you have the beta) to perform your windowing (Rank & Window tile in ETL 2.0) to calculate your unique ID (row number then combine the fields together in another tile) then use that new column & dataset in your card to perform your count distinct.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2
Answers
-
Hi @HashBrowns
Domo doesn't like it when you try and take an aggregate (count) of another aggregate (row_number). There's some caveats to this with window functions but how you're utilizing this is why.
What I'd recommend you do is create a new Magic ETL (or a Dataset View if you have the beta) to perform your windowing (Rank & Window tile in ETL 2.0) to calculate your unique ID (row number then combine the fields together in another tile) then use that new column & dataset in your card to perform your count distinct.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 659 Datasets
- 116 SQL DataFlows
- 2.2K Magic ETL
- 816 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 82 App Studio
- 45 Variables
- 776 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 82 Workflows
- 23 Code Engine
- 40 AI and Machine Learning
- 20 AI Chat
- 1 AI Playground
- 1 AI Projects and Models
- 18 Jupyter Workspaces
- 410 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 10 Software Integrations
- 144 Manage
- 140 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 114 Community Announcements
- 4.8K Archive