"current year, current month" and "previous year, current month" Beast Modes
Hi,
I'm trying to create a 'current year, current month' and 'previous year, current month' beast mode.
To this point I have created a current year to date but am not sure of the syntax. I have watch multiple videos and have searched high and low through domos resources.
Any help with the syntax would be helpful
Here is the beast mode that we have that works for the 'current year to date' and previous year to date:
case when year(`Transaction Date`) = year(CURDATE()) then `amount` end
Case when Year(`Transaction Date`) = Year(curdate())-1 then `amount` end
If this helps, feel free to agree, accept or awesome it!
Comments
-
@damen Current month:
case when YEAR('Transaction Date') = YEAR(CURDATE()) and MONTH('Transaction Date') = MONTH(CURDATE()) then 'amount' end
Previous year, current month (assuming this means same month last year):
case when YEAR('Transaction Date') = YEAR(CURDATE()) -1 and MONTH('Transaction Date') = MONTH(CURDATE()) then 'Amount' end
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**
3 -
Here is what I was thinking the syntax should look like for the current month, current year but I cant get it to return and values and the formula shows it as a string instead of numbers
case when month(`Transaction Date`) = MONTH(CURRENT_DATE) then `amount` end
If this helps, feel free to agree, accept or awesome it!
0 -
@RobSomers Thanks again man. I didnt realize I needed the AND portion of that. much appreciated
If this helps, feel free to agree, accept or awesome it!
0 -
@RobSomers Ok so I am still getting both of these functions wanting to run as string
If this helps, feel free to agree, accept or awesome it!
0 -
You can multiply amount by 1 to force it to be a number or change the data type in an ETL
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2 -
@GrantSmith so I did get them to show up as a number but values are still not showing.
**disclaimer: this is for the domo data specialist practical test
If this helps, feel free to agree, accept or awesome it!
0 -
@RobSomers Yeah, my bad. I did get the current year and previous year to return values after a few tweaks to it.
I am trying to do the last two on the list now.
If this helps, feel free to agree, accept or awesome it!
0 -
@damen The beast mode I gave you that you were using and wasn't working for YTD is actually the beast mode for Current Year, Current Month. My original post also has the Previous Year, Current Month beast mode.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**
1 -
@RobSomers I'm still running into the same issue in that I'm not returning any data when I use that formula. I've tried different variations of it and nothing returns any values. the syntax does make sense tho. i just am not sure what i am doing wrong.
If this helps, feel free to agree, accept or awesome it!
0 -
The first picture is what works for current year. I tried to just enter in the 'AND MONTH' portion of it and try the same format (and a few other ones) but again, no values have been returned at all.
If this helps, feel free to agree, accept or awesome it!
0 -
@damen Just noticed that the beast mode you posted of what you're using, you put:
then 'amount' end
You're using 'amount' as a string so you're saying when the row meets that condition put in the word 'amount' and since the column is intergers, it comes in as nothing. You need to use whatever column contains your values.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**
2 -
@damen In your screenshot where you showed the "Current Year" beast mode, be sure to use the " ` " symbol around your Transaction Date and amount fields, instead of " ' ", so that Domo knows you are referring to columns.
It should look like this, when forcing to a number as @GrantSmith suggested:
case when YEAR(`Transaction Date`) = YEAR(CURDATE()) and MONTH(`Transaction Date`) = MONTH(CURDATE()) then `amount`*1 end
2 -
@RobSomers its def the amount column that contains the values. I'm confused. are the integers not calculated as values? The first beast mode (2nd picture) where we are only calculating current year, returns values
If this helps, feel free to agree, accept or awesome it!
0 -
@MichelleH Yeah, sorry. Here are the updated views. I'm currently dealing with the 2nd picture being able to returning values and the first picture doesn't.
If this helps, feel free to agree, accept or awesome it!
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