YTD BeastMode with Variables
I have 2 variables 'Year Selector' and 'Month Selector' that are being used as filters drop down selection in an App
But also used within a YTD BeastMode:
SUM(CASE
WHEN Year Selector
= Fiscal Year
AND Month Number
>= 2
AND Month Number
<= CASE
WHEN Month Selector
= 'January' THEN 1
WHEN Month Selector
= 'February' THEN 2
WHEN Month Selector
= 'March' THEN 3
WHEN Month Selector
= 'April' THEN 4
WHEN Month Selector
= 'May' THEN 5
WHEN Month Selector
= 'June' THEN 6
WHEN Month Selector
= 'July' THEN 7
WHEN Month Selector
= 'August' THEN 8
WHEN Month Selector
= 'September' THEN 9
WHEN Month Selector
= 'October' THEN 10
WHEN Month Selector
= 'November' THEN 11
WHEN Month Selector
= 'December' THEN 12
ELSE 0
END
THEN IFNULL(Amount
* -1, 0)
ELSE 0
END)
The problem with this is my Fiscal Year starts from Feb 2024 - Jan 2025. So with the current BeastMode, YTD for all other months are correct except for January.
Example: with the current BeastMode, Jan 2025 YTD is Feb 2024 - Dec 2024 (which is not correct) instead of Feb 2024 - Jan 2025 (this is correct).
Is there any way I could alter my Beastmode?
Best Answer
-
What if you change January to 13 instead of 1? That should cause it to treat January as part of your fiscal year Feb 2024 - Jan 2025.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **1
Answers
-
What if you change January to 13 instead of 1? That should cause it to treat January as part of your fiscal year Feb 2024 - Jan 2025.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **1 -
@ArborRose That could be feasible but with my
Year Selector
variable, changing Jan to 13 may not work.
For example: if theYear Selector
= 2025 and theMonth Selector
= January, the calculation would include all months from February to January of the following year (since January is represented by 13).Therefore, January 2025 YTD = sum the amounts from February 2025 to January 2026 (which is not correct). It should be Feb 2024 - Jan 2025 instead
0 -
I don't have an example set up to try this.
SUM(CASE
WHEN (
(Year Selector = Fiscal Year AND Month Number >= 2) -- From February to December of the current fiscal year
OR
(Year Selector = Fiscal Year + 1 AND Month Number = 1) -- Include January of the next calendar year
)
AND Month Number <=
CASE
WHEN Month Selector = 'January' THEN 1 -- Stop at January for Year Selector = Fiscal Year + 1
WHEN Month Selector = 'February' THEN 2
WHEN Month Selector = 'March' THEN 3
WHEN Month Selector = 'April' THEN 4
WHEN Month Selector = 'May' THEN 5
WHEN Month Selector = 'June' THEN 6
WHEN Month Selector = 'July' THEN 7
WHEN Month Selector = 'August' THEN 8
WHEN Month Selector = 'September' THEN 9
WHEN Month Selector = 'October' THEN 10
WHEN Month Selector = 'November' THEN 11
WHEN Month Selector = 'December' THEN 12
END
THEN IFNULL(Amount * -1, 0)
ELSE 0
END)** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **1 -
Thank you for the reply! I also do not have the data for January yet so I couldn't test it out.
But(Year Selector = Fiscal Year + 1 AND Month Number = 1) -- Include January of the next calendar year)
AND Month Number <= CASE
WHEN Month Selector = 'January' THEN 1
this YTD would only return January 2025, so maybe changing January to 13 instead of 1 would work?0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 622 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 744 Beast Mode
- 58 App Studio
- 41 Variables
- 686 Automate
- 176 Apps
- 453 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 395 Distribute
- 113 Domo Everywhere
- 276 Scheduled Reports
- 6 Software Integrations
- 125 Manage
- 122 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive