Multi-value Columns Gauge Card | Compare between Current Headcount vs. Dynamic Historical Month
I have a situation where I am trying to show how the Headcount moved by comparing Current Month Headcount with any of the historical Month which the user will select. The problem that I am facing is that when any period gets selected Current Month Headcount calculation becomes Zero. My dataset is very complex and massive but just to keep the focus on the key issue, I am sharing a sample data table below.
In the above Data table image,
Column Ref row is to help explain the formula
Filter Option is what the user will choose. I have added it here for easy understanding
Date and Headcount rows are from the Dataset.
Calculation based on user selection:
- If user Select Filter Option as '30 Days Prior' then Headcount Change =
Column B - Column A
and Headcount Change % =(Column B - Column A) / Column A
- If user Select Filter Option as '60 Days Prior' then Headcount Change =
Column C - Column A
and Headcount Change % =(Column C - Column A) / Column A
- If user Select Filter Option as '90 Days Prior' then Headcount Change =
Column D - Column A
and Headcount Change % =(Column D - Column A) / Column A
- If user Select Filter Option as '120 Days Prior' then Headcount Change =
Column E - Column A
and Headcount Change % =(Column E - Column A) / Column A
- If user Select Filter Option as '150 Days Prior' then Headcount Change =
Column F - Column A
and Headcount Change % =(Column F - Column A) / Column A
- If user Select Filter Option as '180 Days Prior' then Headcount Change =
Column G - Column A
and Headcount Change % =(Column G - Column A) / Column A
- If user Select Filter Option as '210 Days Prior' then Headcount Change =
Column H - Column A
and Headcount Change % =(Column H - Column A) / Column A
Will appreciate if someone can help me with this.
Best Answer
-
Hi @DavidChurchman , Thanks for your guidance. I will certainly try Appraoch 1.
PS. I drafted my last response 7 hours back but forgot to post it. As of now, I kind of found out a solution. Currently testing the performance of the card.
Beast Modes I used are -
Current Month :
COALESCE(SUM(CASE WHEN Period Selection = 'Same Period' THEN Headcount - Actual ELSE 0 END), 0)
FIXED (REMOVE Date)Dynamic Previous Month :
CASE
WHEN Compare Period = 'Previous Month'
THEN SUM(CASE WHEN Period Selection = '30 Days Prior' THEN IFNULL(Headcount - Actual,0) ELSE 0 END)
WHEN Compare Period = 'Previous Month End -1'
THEN SUM(CASE WHEN Period Selection = '60 Days Prior' THEN IFNULL(Headcount - Actual,0) ELSE 0 END)
WHEN Compare Period = 'Previous Month End -2'
THEN SUM(CASE WHEN Period Selection = '90 Days Prior' THEN IFNULL(Headcount - Actual,0) ELSE 0 END)
WHEN Compare Period = 'Previous Month End -3'
THEN SUM(CASE WHEN Period Selection = '120 Days Prior' THEN IFNULL(Headcount - Actual,0) ELSE 0 END)
ENDCompare Period is a Variable that I created.
Period Selection is a Field/ Column which I created in the Dataset View.
0
Answers
-
Hello @Ankur,
To disable filtering on the table, edit the dashboard, select "Edit Content" on the table, then choose "Change Filter Exceptions" to turn off filtering.
If you found this post helpful, please use 💡/💖/👍/😊 below! If it solved your problem, don't forget to accept the answer.
0 -
What I recommend is restructuring your data so that for each date you have a period type defined which is in relation to the selected date. This will allow the users to select a specific date and then also a period type which you can then filter on to show data relative to your filtered date. I've done a write up on how to do this here: https://community-forums.domo.com/main/discussion/53481/a-more-flexible-way-to-do-period-over-period-comparisons#latest
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
I would look into using variables instead of filters as filters will filter out data that it sounds like you need. Variables will allow you to build a beast mode that will do the desired calculation based on the selection made in the variable.
Here is one video on variables if you are unfamiliar with them:
**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.0 -
GrantSmith's restructure would be more dynamic than what I'll suggest, but if you want something a bit simpler:
Approach 1: ETL a Baseline Column
All of your 7 BeastModes are comparing to the same baseline. You could just use an ETL to filter for that baseline data and join it back as a "baseline" column to your dataset, which would make writing your % change easy to do and reactive to any filter.
Approach 2: Use a POP chart (no BeastModes)
You could just use the Date and Headcount columns as is in a period-over-period chart, which can calculate percent change and value change, and you could graph by month and add Date as a Quick filter. Somehting like this:
Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
0 -
Although, I have mentioned in the subject that I will be using Multi-value Columns Gauge Card, but maybe the data table that I have shared can confuse. Hence, for everyones better understanding sharing below how the output will look like.
Period Selection is a Variable field, which the user will choose as per what they want to see.
321,678 is the current Month Headcount, which will not change - no matter whatever period gets selected.
30 Days Prior (319,321 is the value of this field) is the Dynamic Headcount which will change based on users Period Selection. Even the Lable will change based.
Headcount Difference & -0.7% is a calculated field and cobmination of above 2 statements (321,678 & 30 Days Prior).
@Manasi_Panov , Delecting the Filter will not help as in the same card except Current Headcount (ie. 321,678) rest everything needs to work with Filter. Thanks for your suggestion though.
@MarkSnodgrass , I am using Variables in Period Selection. I have gone through the video and my requirement is not the same. Appreciate your help.
@GrantSmith , Thanks for your valuable feedback. I am going through the article currently. Will update if that helped.
I have tried multiple Beast Modes but none worked. Sharing some of the Formulas:
Formula 1:
CASE
WHEN Compare Period = 'Same Period' THEN SUM(SUM(Headcount - Latest) FIXED (REMOVE Date))
WHEN Compare Period = '30 Days Prior' THEN SUM(SUM(Headcount - Latest) FIXED (REMOVE Date))
WHEN Compare Period = '60 Days Prior' THEN SUM(SUM(Headcount - Latest) FIXED (REMOVE Date))
WHEN Compare Period = '90 Days Prior' THEN SUM(SUM(Headcount - Latest) FIXED (REMOVE Date))
WHEN Compare Period = '120 Days Prior' THEN SUM(SUM(Headcount - Latest) FIXED (REMOVE Date))
WHEN Compare Period = '150 Days Prior' THEN SUM(SUM(Headcount - Latest) FIXED (REMOVE Date))
WHEN Compare Period = '180 Days Prior' THEN SUM(SUM(Headcount - Latest) FIXED (REMOVE Date))
ENDFormula 2:
CASE
WHEN Date = MAX(Date) OVER () AND Period Selection = 'Same Period'
THEN SUM(Headcount - Actual)
ELSE 0
ENDIn MS PowerBi, we could achieve this easily by using REMOVEFILTERS function. I am looking for something like that.
0 -
Hi @DavidChurchman , Thanks for your guidance. I will certainly try Appraoch 1.
PS. I drafted my last response 7 hours back but forgot to post it. As of now, I kind of found out a solution. Currently testing the performance of the card.
Beast Modes I used are -
Current Month :
COALESCE(SUM(CASE WHEN Period Selection = 'Same Period' THEN Headcount - Actual ELSE 0 END), 0)
FIXED (REMOVE Date)Dynamic Previous Month :
CASE
WHEN Compare Period = 'Previous Month'
THEN SUM(CASE WHEN Period Selection = '30 Days Prior' THEN IFNULL(Headcount - Actual,0) ELSE 0 END)
WHEN Compare Period = 'Previous Month End -1'
THEN SUM(CASE WHEN Period Selection = '60 Days Prior' THEN IFNULL(Headcount - Actual,0) ELSE 0 END)
WHEN Compare Period = 'Previous Month End -2'
THEN SUM(CASE WHEN Period Selection = '90 Days Prior' THEN IFNULL(Headcount - Actual,0) ELSE 0 END)
WHEN Compare Period = 'Previous Month End -3'
THEN SUM(CASE WHEN Period Selection = '120 Days Prior' THEN IFNULL(Headcount - Actual,0) ELSE 0 END)
ENDCompare Period is a Variable that I created.
Period Selection is a Field/ Column which I created in the Dataset View.
0
Categories
- All Categories
- 1.9K Product Ideas
- 1.9K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 303 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3K Transform
- 104 SQL DataFlows
- 640 Datasets
- 2.2K Magic ETL
- 4K Visualize
- 2.5K Charting
- 769 Beast Mode
- 72 App Studio
- 43 Variables
- 718 Automate
- 185 Apps
- 462 APIs & Domo Developer
- 57 Workflows
- 14 DomoAI
- 40 Predict
- 17 Jupyter Workspaces
- 23 R & Python Tiles
- 402 Distribute
- 116 Domo Everywhere
- 277 Scheduled Reports
- 9 Software Integrations
- 135 Manage
- 132 Governance & Security
- 8 Domo Community Gallery
- 44 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 111 Community Announcements
- 4.8K Archive