Creating an "unassigned" row for gantt chart visualization
I'm working on a gantt chart visualization for resource assignments, and trying to add an "unassigned" bar to the chart for any time periods when a resource is not assigned to a project.
My dataset is generally structured as resource name, assignment name, start date, end date:
I've pulled in the domo dimensions calendar data set, and have been able to explode out these dates so that I have 1 row per resource, per assignment, per date. I also used this to create rows where Assignment Name = 'UNASSIGNED' if the resource has no assignment for a given date. I then tried grouping by resource name and date so that I had a column assignment type equal to either 'ASSIGNED' or 'UNASSIGNED' for each date, and that's where I got stuck:
I'm not sure how to take this and get the start and end date for each section of 'UNASSIGNED' to append to the original format so I can put it on the gantt chart. I thought I could do a group by but then realized that using that and the min/max functions would give me the very first date someone is unassigned and the very last date - but if there are multiple sections where they are unassigned (as above it would be 2/15/2022-2/28/2022 and then 5/1/2022 and on), it would not be correct.
Has anyone done something similar to this? Any tips or ideas? Is there an easier way to do this that I'm just missing?
Best Answer
-
I would suggest keeping your data in your original format and then building out your unassigned dates by using the rank and window tile and a formula tile. I did it by doing the following:
- Connect your original dataset to a rank and window tile and then create a column called Last End Date and choose the Lag function using the End Date column with an offset of 1. Order by the start ascending and partition on the resource name
- Add a formula tile next and create 3 columns that look like this
This will result in an output like this:
You can then filter to unassigned equal 1 and overwrite your assignment name column to unassigned and then append to your original dataset using the unassigned start and end dates as your start and end dates.
Hope that makes sense.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.3
Answers
-
I would suggest keeping your data in your original format and then building out your unassigned dates by using the rank and window tile and a formula tile. I did it by doing the following:
- Connect your original dataset to a rank and window tile and then create a column called Last End Date and choose the Lag function using the End Date column with an offset of 1. Order by the start ascending and partition on the resource name
- Add a formula tile next and create 3 columns that look like this
This will result in an output like this:
You can then filter to unassigned equal 1 and overwrite your assignment name column to unassigned and then append to your original dataset using the unassigned start and end dates as your start and end dates.
Hope that makes sense.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.3 -
@MarkSnodgrass thank you!! This was really helpful (and much simpler than what I was thinking) - I was able to take this and run with this to get what I need.
Writing up the full solution for anyone who runs into something similar:
I anonymized a subset of the data and ended up finding some edge cases I hadn't considered - 1) resources with no assignment and 2) unassigned days before the first assignment for the resource and after the last assignment for a resource and 3) overlapping resource assignments i.e. Assignment A and B have the same start date but different end dates:
I applied the logic you gave me (and added a sort on end date in the rank and window to handle overlapping assignments like curly's that both start 10/13) which filled in all the gaps:
I was then able to extend the logic to handle these red bars:
The case where nobody is assigned is a simple formula for start date is null and end date is null.
For the days before the first start date:
- Rank and window tile - create a column last_start_date that is the lag of start date, ordered on start and end date
- Formula tile:
For the days after the last end date:
- Rank and window tile - create a column next_end_date that is the lead of start date, ordered on start and end date
- Formula tile:
Then append all of these to the original dataset and boom, magic.
Now I just have to switch in the real dataset to this logic :)
2 -
Thanks for the detailed write up of your solution!
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0
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