# Demo Marketing Calendar added to DOMO-DOJO

Contributor

Hi I'm Duncan Domo and I'm new to this!! So hopefully posting in the right place.

Summary: I built a Demo Marketing Calendar added to DOMO-DOJO

I had a problem and I found a solution thanks to a video/advice from ﻿@jaeW_at_Onyx﻿

Video: https://www.youtube.com/watch?v=UO9YUfkSh7I watch this if you want to get into complex FY calendars.. my problem was more simple.. But this is fantastic video.. thanks again @jaeW_at_Onyx I thoroughly recommend browsing the channel and watching the Jae shows you how vids...

Problem: want to display marketing activities on DOMO calendar but only takes one date argument (great for webinars, not good for events that have start / end date)

Solution: Explode start / end date into rows per day (3 day event = 3 rows)

By joining to a "SQL numbers table"

I also did a hyperlink in a table for a fictional activity URL link for fun.. so it's 3 demos for the price of 1 today.

Part 1 - Create the SQL numbers table

Solution run stored proc in SQL transform with double while loop

Step 1 -

step 2 - this uses 1 based index as for date handling - you could change this to start at 0 for other things

step 3 call it - you can amend the number if you need bigger numbers.. or if you need crazy big numbers talk to @jaeW_at_Onyx who can do magic maths with cross joins..

step 4 - select * that bad boy into an output table..

Bing bang bong, you can join to that table anytime you need to explode a date range.. read on...

Part 2 - Explode the date range (take cover) using ETL

1. First calculate the number of days of event (using date diff)

2. Join number of days to you SQL numbers table

3. Calculate "display date" by adding day number to start date.. BOOM you are calendar ready

Note: I split the dataset in two, one set are single day activities (emails), one set are multi day events (get the above treatment), then I append them back together before outputting the final dataset

step 1

Step 2

Step 3

Finally, put it all back together and output the result..

Part 3 - Output to calendar dashboard, the finished package..

• Display StartDate (adjusted above to be a logical display date, could put in an extra column)
• Add a HTML table to make a clickable link for activity

Step 1 - Chart type = Calendar

Step 2 - HMTL table with a beast mode that adds <a> </a> tags round some data

Part 4 - finally put it all together on Dashboard and config interaction behaviour

Interation behaviour..

card 1 =

Card 2 =

And that's it.. you now have a Marketing activity calendar which explodes multi-day activity day data into rows per day..

That's it.. hope you like it.. My first full solution.. so I'd love some feedback, so if you used it / liked it, please give it a like.. if not, drop some comments below with some suggestions.

Enjoy,

Duncan Domo

Tagged:

• Coach

Hey @DuncanDomo

Thanks for the contribution. Great writeup. One question I had was have you thought about just doing a join on the date table and your start and end dates?

```select *
from calendar_dates d
left join events e on e.start_date >= d.date and e.end_date <= d.date
```
**Did this solve your problem? Accept it as a solution!**
• Coach

Whoop this is amazing @DuncanDomo

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"
• Contributor

Cheers @GrantSmith, ohhh I love that idea about a Date Table.. I need to make one those now.. and have a play.. I guess I need to watch that Jae video again and finish doing the whole solution... I'll have a play with both ideas.. I have a feeling your solution might win the day for my final real thing.. Thanks again for the idea..

• Contributor

Anyone interested in an alternative approach.. I implemented @GrantSmith's idea in the DOMO Dojo instance..

Step 1 - build 2021 calendar using the above integer explode technique..

I added a new flow / output to generate every day of 2021 as a table, using webform as input for "year end/start".. like this:

The output looks like this..

Then we are ready to do the SQL Transform to do @GrantSmith's idea..

Step 2 - add a SQL transform (table type) and output table

Here's the SQL Select..

I didn't duplicate putting this on a calendar control as the result from that point on is exactly the same as the original demo above.

Again full credit to @jaeW_at_Onyx for his video about creating an FY calendar, this one: https://www.youtube.com/watch?v=UO9YUfkSh7I. I used that to build the date dimension in step 1.

And of course @GrantSmith for the SQL / date dimension idea

Now, the tricky bit the pros and cons of each approach?? I'm not sure which is best?? Anybody want to comment?

My quick thoughts are:

• SQL numbers explosion = good because all done in ETL so user friendly
• Join to Date Dimension = good because it elegant and less steps. Also has the advantage of being able to store "day info" on the date dimension table that might be useful, like FY Period Week, FY Period Month, TimezoneOffsetinUK, TimezoneOffsetinUSA for every single day of the year

So due to the DateDimension additional info, I might lean towards the Join to DateDimension solution as better real world solution.. Love to hear your thoughts on pros/cons?