Date_Add or Date_Sub Trying to minus a year
Hi Guys,
I'm trying to minus a year from date field coming from Netsuite.
This is what I have but it doesn't seem to be working?
SELECT
DATE_SUB(ENDING, INTERVAL 1 YEAR) 'Last Year'
FROM ACCOUNTING_PERIODS
Any suggestions would be great.
Andrew
Best Answer
-
Oh, I see you're using the NetSuite Analytics Connector.
I'm not too familiar with what functions are available.
I did a quick Google search and found this function that might be helpful:
ADD_MONTHS( {today},-12 )
I believe you insert the column name into the brackets, or replace the example column name and brackets with the column name. You could experiment and see what works.
Let me know if you get it figured out!
**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'2
Answers
-
Hey Andrew,
You could try Date_add, I'm assuming you're doing this in MySQL?
SELECT
DATE_ADD(`Ending`, Interval -1 Year) as `Last Year`
FROM ACCOUNTING_PERIODS
Is there a specific error that's being thrown? That might be useful to better understand what you're seeing.
Hope this is helpful!
**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'0 -
Hey,
Thanks for the prompt reply, the error is ;
[NetSuite][SuiteAnalytics Connect JDBC Driver][OpenAccess SDK SQL Engine]Syntax Error in the SQL statement.[10104]
I have attached the screenshot.
Regards
Andrew
0 -
Oh, I see you're using the NetSuite Analytics Connector.
I'm not too familiar with what functions are available.
I did a quick Google search and found this function that might be helpful:
ADD_MONTHS( {today},-12 )
I believe you insert the column name into the brackets, or replace the example column name and brackets with the column name. You could experiment and see what works.
Let me know if you get it figured out!
**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'2 -
Thank you so much!!
2 -
**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'0 -
hello :)
this could be use for calculate YOY growth?
0 -
@Ana I strongly recommend against building reporting logic into your connectors. reporting logic is something that would change regularly and should be something a little closer to the hands of the business analyst.
extract your data from your source system as cleanly as possible, then build any reporting functionality using dataflows, views or in analyzer.
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"2
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 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