How to Combine 2 DataSets to a Filtered Count/Aggregated DataSet with different colums
TLDR: This is a complicated dataset (for me) that I am trying to build. Basically, I am taking data from two datasets, with different columns, aggregating them to columns that is listed correctly in rows... If that makes sense. I need help going about it the right way.
Enviroment:
Below is sample data I have and what I am trying to build from it... so you have an idea of what I am working with.
Input DataSet 1:
DateA: | DateB: | Employee: | Sales Stage: |
3/3/2018 | 3/5/2018 | John Doe | Closed Won |
3/25/2018 | 3/27/2018 | Jayne Doe | Closed Lost |
3/16/2018 | 3/18/2018 | John Doe | Closed Won |
4/1/2018 | 4/5/2018 | John Doe | Closed Won |
4/15/2018 | 4/17/2018 | Jayne Doe | Closed Lost |
4/20/2018 | 4/21/2018 | Jayne Doe | Closed Won |
Input DataSet 2:
DateC: | Employee: | Comm Structure: | Sales: |
3/31/2018 | John Doe | Consultant | 100 |
3/31/2018 | Jayne Doe | Coach | 200 |
4/30/2018 | John Doe | Consultant | 300 |
4/30/2018 | Jayne Doe | Coach | 350 |
Please note that the 'Input DataSet 2' entires listed are monthly summery stats. Each employee will have one entry for the month (the date is just listed as the 'last day of the month').
Output DataSet (What I am trying to achieve):
Date: | Employee: | Comm Structure: | Sales: | Total Ops: | Ops Won: | Avg Op Sales: | Avg Op Sales Won: |
3-2018 | John Doe | Consultant | 100 | 2 | 2 | 50 | 50 |
3-2018 | Jayne Doe | Coach | 200 | 1 | 0 | 200 | 0 |
4-2018 | John Doe | Consultant | 300 | 1 | 1 | 300 | 300 |
4-2018 | Jayne Doe | Coach | 350 | 2 | 1 | 175 | 350 |
What I currently have setup is using a dataflow to append the rows together with all columns from both tables. I then have calculated field(s) via 'Beast Mode' to 'Count' the 'Closed Lost' and 'Closed Won' sales stages. I am having a hard time using the count function by grouping the months together, but also inserting it on the same row as the summery entry for that specific month and employee. Below is what I currently got:
CASE WHEN DATE_FORMAT(`DateB`,'%M %Y') = DATE_FORMAT(`DateC`,'%M %Y') THEN
COUNT(`Sales Stage`)
END
Once I get the counts inserted correctly in the row, I can get the averages from there.
Question:
Am I going about this all wrong? I have been working on this for a couple days, but I am getting no where. Should I be filtering/agregatting the data with the options availible in the dataflow first? Any direction on how I may accomplish this would be appreciated.
Categories
- All Categories
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 295 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 97 SQL DataFlows
- 608 Datasets
- 2.1K Magic ETL
- 3.8K Visualize
- 2.4K Charting
- 709 Beast Mode
- 49 App Studio
- 39 Variables
- 667 Automate
- 170 Apps
- 446 APIs & Domo Developer
- 44 Workflows
- 7 DomoAI
- 33 Predict
- 13 Jupyter Workspaces
- 20 R & Python Tiles
- 391 Distribute
- 111 Domo Everywhere
- 274 Scheduled Reports
- 6 Software Integrations
- 115 Manage
- 112 Governance & Security
- Domo Community Gallery
- 31 Product Releases
- 9 Domo University
- 5.3K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 103 Community Announcements
- 4.8K Archive