Displaying Zero Hires by Month for Different Segments in Line Charts
I want to display the total number of hires (on the y-axis) over time, organized by months (on the x-axis), and Segments X,Y,Z (In series)using a line chart. However, there are months when no hires occurred for a specific segment, and in those cases, I want to show zero on the chart instead of having it remain empty. How can I accomplish this?
Best Answer
-
@lawiti Be sure to remove `Hires` from the Y-axis and `Segment` from the series. Line charts are set up to expect either one measure in the Y-Axis and one dimension in the Series OR multiple measures (one in the Y-axis and the others in Series). If you still have your segment in the series spot, it will not allow you to add more fields
2
Answers
-
@pauljames I have it selected but still not showing the zeros on the chart
0 -
@pauljames , thanks, I switched to grouped bar charts but still not showing the zeros, the data is a bit sensitive so I might not share here.
0 -
I tried this, IFNULL(SUM(
Hires
), 0), still not showing the zeros0 -
IF I SOLVED YOUR PROBLEM, PLEASE "ACCEPT" MY ANSWER AS A SOLUTION. THANK YOU!
0 -
@lawiti If you are using a dimension field in the series, then your lines will be null instead of zero whenever there are no rows that meet that criteria. Instead of using Hires in the Y axis and a dimension in the series, try using a beast mode for each line like this:
sum(case when `Segment` = 'X' then `Hires` else 0 end)
0 -
The other thing I've done is in a dataflow just appended a date dimension so there's a "row" for each date, even if there's no "actual" data. Only caveat is you need to make sure your blank date rows match your card filters otherwise they won't help.
0 -
@MichelleH
Thank you for the suggestion, I tried this
SUM(CASEWHEN `Segment` = 'A' THEN `Hires`
WHEN `Segment` = 'B' THEN `Hires`
WHEN `Segment` = 'C' THEN `Hires`
WHEN `Segment` = 'D' THEN `Hires`
WHEN `Segment` = 'E' THEN `Hires`
ELSE 0
END)
But still not showing the zeros, I have checked my data label setting, show when zero.
When I look at the dataflow output, I actually see the zeros,because this is how I calculated hires
Case when YEAR((Hire_Date
)) = YEAR(CURDATE()) ANDEmployment_Status
like 'Active' orEmployment_Status
like 'Leave' orEmployment_Status
like 'Active-Restricted Duty' or (Employment_Status
like 'Terminated' and YEAR((Termination_Date
)) = YEAR(CURDATE())and YEAR((Hire_Date
)) = YEAR(CURDATE()) ) then 1 else 0 end0 -
@lawiti You will need to make a separate beast mode for each segment, otherwise it will function the same as using just the `Hires` field. The reason you need individual beast modes is so that the formula evaluates every single row of data and return a result of 0 if the segment does not match the one you want, which then ensures that can see a zero value.
0 -
@MichelleH , I have done that, but it seems I won't be able to use the line chart anymore?
0 -
@lawiti Be sure to remove `Hires` from the Y-axis and `Segment` from the series. Line charts are set up to expect either one measure in the Y-Axis and one dimension in the Series OR multiple measures (one in the Y-axis and the others in Series). If you still have your segment in the series spot, it will not allow you to add more fields
2 -
@MichelleH , that works.Thank you!!
0 -
I'm late to the party but another alternative would be to explicitly have a 0 record in your dataset for the months you don't have any hires.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1 -
@GrantSmith , wouldn't my ifnull suggestion taken care of that though?
IF I SOLVED YOUR PROBLEM, PLEASE "ACCEPT" MY ANSWER AS A SOLUTION. THANK YOU!
0 -
Depends on the data and the chart being used. Some charts allow you to display missing dates on it but there actually isn't any data so it displays null. If the data actually has the dates and is set to null then your method would work.
**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
- 754 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