Calculating Months Between Dates
Hello,
I am attempting to calculate the months between two dates as precisely as possible.
I don't want to just compare the months themselves, since that would make the consecutive dates of 4/30/18 and 5/1/18 (months 4 and 5) have 1 month passed.
I know this can be done roughly by calculating the days passed and dividing it by the average # of days in a month, but is there a more precise way to do this that compares once that same day (ex. the 10th) is reached or passed on a following month to signify the passing of a month?
Thanks
Comments
-
My suggestion would use the datediff feature then have that be divided by the number of days in the specific month you want to reference. So I would begin with a beastmode to assign each month how many days are in it.
(case when month= 4 then 30
when month =5 then 31
when month = 6 then 30 etc
then you could write a statement like datediff/month from beastmode and it should give you a more precise count on months that passed
I know that this wasnt the most precise answer but maybe it can start some other ideas
0
Categories
- 10.5K All Categories
- 8 Connect
- 918 Connectors
- 250 Workbench
- 470 Transform
- 1.7K Magic ETL
- 69 SQL DataFlows
- 477 Datasets
- 193 Visualize
- 252 Beast Mode
- 2.1K Charting
- 11 Variables
- 17 Automate
- 354 APIs & Domo Developer
- 89 Apps
- 3 Workflows
- 20 Predict
- 5 Jupyter Workspaces
- 15 R & Python Tiles
- 247 Distribute
- 63 Domo Everywhere
- 243 Scheduled Reports
- 21 Manage
- 42 Governance & Security
- 174 Product Ideas
- 1.2K Ideas Exchange
- 12 Community Forums
- 27 Getting Started
- 14 Community Member Introductions
- 55 Community News
- 4.5K Archive