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.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 731 Beast Mode
- 55 App Studio
- 40 Variables
- 683 Automate
- 175 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 122 Manage
- 119 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 107 Community Announcements
- 4.8K Archive