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! **2
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! **2 -
@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! **2 -
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
- Product Ideas
- 2.1K Ideas Exchange
- Connect
- 1.3K Connectors
- 309 Workbench
- 7 Cloud Amplifier
- 10 Federated
- Transform
- 664 Datasets
- 120 SQL DataFlows
- 2.3K Magic ETL
- 824 Beast Mode
- Visualize
- 2.6K Charting
- 86 App Studio
- 46 Variables
- Automate
- 194 Apps
- 486 APIs & Domo Developer
- 90 Workflows
- 24 Code Engine
- AI and Machine Learning
- 23 AI Chat
- 4 AI Projects and Models
- 18 Jupyter Workspaces
- Distribute
- 119 Domo Everywhere
- 283 Scheduled Reports
- 11 Software Integrations
- Manage
- 143 Governance & Security
- 11 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 116 Community Announcements
- 5K Archive