ETL - How to spread a Budget over two dates within a variable date range.
I have various start and end dates for campaigns. I know how to calculate the # of days between any get set of dates. But, what I am trying to set up in the etl is this - if I have a budget amount, start date and end date, what is the easiest way for me to have the etl calculate the division of the budget over the given start and end dates?
e.g. let's say I have a $9800 budget, and I set the start date/end date for 4/17/2024 - 10/12/2024. I want it evenly distributed over the number of days, etc.
I would want the to know a couple metrics from these inputted values,
The Daily Budget
The Monthly Budget (taking into account that April and October are not full months)
And those values projected for future months.
Is there a way to set this up in the ETL?
Best Answer
-
The easiest way would be to use a date dimension table and a cross join (Cartesian Product). Say you have your budget dataset.
You would join your date dimension table (a dataset that has a row for every day) with your budget dataset.
You would then filter to where dt (the day in your date dataset is >= start_date and < = end_date.
You can then calculate the number of days between your start and end dates. Note, you could also make use of the "Date Operations" tile if you wanted the number of working days between these dates. Then divide your total budget by the number of days to get the daily budget.
For the monthly the easiest way would be to connect this dataset to a card and then aggregate the daily total by month.
For example
David Cunningham
** Was this post helpful? Click Agree 😀, Like 👍️, or Awesome ❤️ below **
** Did this solve your problem? Accept it as a solution! ✔️**1
Answers
-
The easiest way would be to use a date dimension table and a cross join (Cartesian Product). Say you have your budget dataset.
You would join your date dimension table (a dataset that has a row for every day) with your budget dataset.
You would then filter to where dt (the day in your date dataset is >= start_date and < = end_date.
You can then calculate the number of days between your start and end dates. Note, you could also make use of the "Date Operations" tile if you wanted the number of working days between these dates. Then divide your total budget by the number of days to get the daily budget.
For the monthly the easiest way would be to connect this dataset to a card and then aggregate the daily total by month.
For example
David Cunningham
** Was this post helpful? Click Agree 😀, Like 👍️, or Awesome ❤️ below **
** Did this solve your problem? Accept it as a solution! ✔️**1
Categories
- All Categories
- 1.5K Product Ideas
- 1.5K Ideas Exchange
- 1.4K Connect
- 1.1K Connectors
- 283 Workbench
- 4 Cloud Amplifier
- 4 Federated
- 2.7K Transform
- 90 SQL DataFlows
- 565 Datasets
- 2K Magic ETL
- 3.4K Visualize
- 2.3K Charting
- 593 Beast Mode
- 13 App Studio
- 28 Variables
- 588 Automate
- 143 Apps
- 417 APIs & Domo Developer
- 27 Workflows
- 1 DomoAI
- 28 Predict
- 12 Jupyter Workspaces
- 16 R & Python Tiles
- 361 Distribute
- 99 Domo Everywhere
- 260 Scheduled Reports
- 2 Software Integrations
- 96 Manage
- 93 Governance & Security
- 15 Product Releases
- Community Forums
- 37 Getting Started
- 28 Community Member Introductions
- 90 Community Announcements
- 4.8K Archive