Can you use Magic ETL to 'explode' table of transactions to all days?
Table A has transactions that show an item's "Old Status" and "New Status" along with the date of the transaction. For example, row 1 shows that item XYZ changed from "Regular Price" to "Promo Price" on 1/1/2023. Row 2 shows that item XYZ changed from "Promo Price" to "Regular Price" on 1/4/2023. Row 3 shows that item XYZ changed from "Regular Price" to "Clearance" on 1/6/2023. etc
Table B has a list of all items
Using Magic ETL, how can I create Table C to include Date | Item | Status, showing 1 row per item per day for all days including the status listed from Table A
EDIT: The specific challenge is finding a technique that would allow me to identify the 'status' of each item, on each day, using the sparse transactional data from Table A
In the example above, I would expect the following results for item XYZ
1/1/23 | XYZ | Regular Price
1/2/23 | XYZ | Regular Price
1/3/23 | XYZ | Regular Price
1/4/23 | XYZ | Promo Price
1/5/23 | XYZ | Promo Price
1/6/23 | XYZ | Clearance
Best Answer
-
@M_Gonzalez I apologize. After thinking about your situation more, I realized my last suggestion would not get you what you want. I did come up with a way to do it, though, and have created a video to walk you (and anyone else) through how to do it.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0
Answers
-
@M_Gonzalez The Calendar dataset from the Domo Dimensions Connector contains a list of all possible dates. I suggest joining Table A to the Calendar dataset then filtering to remove duplicate statuses
1 -
Thank you for your suggestion. I have updated my original question, which admittedly, was not detailed enough. 😀
0 -
Here's a rough outline of how you would construct your ETL to do what you want.
Bring in the calendar dataset. I suggest filtering it a bit as it has about 30 years of dates in it. You can use a formula in your filter rule to make it dynamic and not hard-code dates in there.
Get a distinct list of products. I used the group by tile to do this by putting the product name in the select section and then doing any sort of aggregation, such as count of products. You won't use the aggregation. It's just an easy way to get a distinct list.
Add a constants tile to each with a field called JoinKey and value of 1 and then join the two together on that JoinKey column. This will give you a list of dates from the calendar for every product you have. For example, if I filtered my calendar to 2023, I would have 365 rows for Product A, 365 rows for Product B, etc…
Do a Left Join that joins your product/calendar data to your main dataset and join on the date and the product.
Add rank & window tile and use the lag function to get the previous status. Use an offset of 1 and and order by the date field from the calendar dataset and partition by product.
Use the formula tile to do an IFNULL to replace blank statuses with the previous status.
Hope this helps.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
@MarkSnodgrass , I knew you'd come through! I was just combing through your Youtube videos trying to see if you had mentioned something like this previously.
For some reason, I never considered using a window function like LAG for a non numerical value.All of that said, I am still a bit lost with this point:
"Use the formula tile to do an IFNULL to replace blank statuses with the previous status."
Can you please elaborate?Thank you so much (for this, and all of the other contributions you make to the community)!
0 -
@M_Gonzalez glad you are enjoying my videos. I think my "Filling in Date Gaps in Domo" would walk you through some of this.
As far the the IFNULL, starting with your rank & window, the name you are assigning for your lag value is what you would be using in your IFNULL along with your main status column. With rank & window tile, you will be creating a new column and you might call it prev_status. Then, in your formula tile, you can fill in the blanks of your main status that exist by writing a formula like this IFNULL(status,prev_status) . This will look at the status column and if it is blank, it will populate it with the prev_status.
I hope this works, but I haven't tested it out fully, but it might get you close to what you need.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
@M_Gonzalez I apologize. After thinking about your situation more, I realized my last suggestion would not get you what you want. I did come up with a way to do it, though, and have created a video to walk you (and anyone else) through how to do it.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
@MarkSnodgrass , you are THE man! I think I would have got there eventually using your "Filling in date gaps" video, but this latest one shows a considerably more efficient method than where I was headed. Thanks again!
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive