Adding Missing dates between start and end date for each category

Hello, I am trying to add missing dates from Start and End date for each category in Magic ETL. I tried to bring in Domo Calendar but confusion is what column from my dataset should I join with Cal.dt? Should that be start date or end date? Also, Then how would I create an output column which will have start date, missing dates and end date all in one col for each category. for eg:

Output requirement is


Comments

  • You are on the right track using the Domo Calendar. What you need to do is an Add Constant tile after each dataset and create a column such as JoinCol and assign a value of 1 to each. Then join the two datasets on that column, using a left join of the calendar so that you get all the dates. If you are just wanting the first day of each month from the calendar dataset, you can filter before the join to where day = 1.

    Here's an example of what the ETL would look like.


    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • I need urgent solution for this issue. I tried to implement above solution of joining Domo Calendar but now I am losing all rows which are not matched with start and end date.

    Currently, I am getting all matched rows

    I want to get all missing weeks as well. The result dataset should be something like following table. All highlighted rows are missing in my output.


    Can anyone help me what should I do?

  • @User2021 did you apply any filtering to the calendar dataset prior to joining with your main dataset? Also, make sure your join criteria only includes the key column. Don't add any other columns to your join criteria.


    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • No filters and it is joining on one date column. Which is the tbl.sales date = cal.dt

  • I am doing outer join to bring all cal dates in. I do get it but then when I filter by key, I lose all extra(added) rows of dates.

  • Ok. In your case, I would suggest a Left Outer Join and make the calendar the left table. This will give you a row for every day and your sales date will have a value when there is a match. You actually won't need that constant field that I described earlier.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • Exactly. I don't have constant but when I filter by key I am losing all cal table rows

  • What are you trying to accomplish when you filter?

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • all dates between start and end date for each key. kind of subset

  • I apologize, I'm having a hard time fully grasping what you are trying to do, but I would suggest a filter tile with a formula rule that looks something like this:

    `salesstartdate` >= `calstartdate` and `salesenddate` <= `calstartdate`
    


    This would filter to where the date from the calendar table is between the sales start and end dates. You may need to try some different variations of this if I am not understanding what your final result set should contain.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • @MarkSnodgrass I am still stuck with this issue. I will try to explain again. I have a dataset with random dates column, ID column and Sales. I am trying to add all missing dates in the dataset. There are multiple sales on a single day , in that case I have grouped them to get one row for one date. Also, I have grouped the date for max and min as 'Start' and 'End' Date.

    This is what I have:

    And this is what I am trying to acheive:


  • This is what my dataflow looks like with adding calendar and filter for start and end dates

    Here each cal date is joining with all dates in the dataset. Lots of extra rows are added to output.

    Join between cal and data is left and cal is left table.

  • Stuck with the same issue, Any solution?

    If Domo supports conditional joins that would have fixed the issue.

  • @user062848 I solved my problem in ETL is that I used Domo calendar dataset and joined with dt col. It has to be left join so that you get all cal dates in the output. Now you have sales col and cal date col. You will use cal date col moving forward since it has all missing dates in it. Do the group by for sales and move on with all modifications. Hope it helps!