Subscribing to Dog Food

I'm sure most dog owners out there can understand that I want to get a break on the cost of dog food. Our youngest dog has allergies and needs limited ingredient, unique protein dog food. It's not that cheap. A few sites offer a discount if you subscribe and get a scheduled shipment. It seems Petco has a good deal - they give a discount along with free shipping and we also get reward points.

The question that remains is how often do we need to receive our shipments. We buy food about once a month, but I'm not exactly sure. Of course I'm going to turn to Tableau to help me figure this out. First step - using my receipts to input the data into Excel (you could also export your bank transactions, but I don't always buy dog food when I go to pet stores).


Save the Excel file, open Tableau, connect to data... and we're off!

I start by looking at the Dates of Purchase, which I drag out onto the row shelf by right-clicking and dragging. This gives me a few options of how I want to view my date field (I select the Discrete option at the top). I use this feature every day and it saves me so much time!


Next I want to calculate the day difference between the previous date and the date of purchase. I start by creating a field called "Previous Date".


I bring that out into my view as well (using the same right-click and dragging). Because the field is a table calculation I need to set how I want it to compute it's values. Clicking the little arrow on the right side of the pill will give me the option to Compute using > Table (Down).


Now I can calculate the day difference. Since the Previous Date field is an aggregation, the Date of Purchase needs to be as well. There are many different aggregation options I could use, but I chose the attribute option since I know I'm looking at each possible date and the most granular level.


Double clicking on my new calculation adds it to my view. While this is already very helpful, the question I am trying to answer is how many weeks between deliveries do I need. I could simply modify my calculation to take the day difference and divide by 7, but I created another calculation so that I could see the values side by side.

I added a few additional attributes to my table and hid the Previous Date column because it's just necessary for the other calculations.


You can see that I could get by with receiving an order every 3 weeks. I'm hoping our dogs continue to make the most out of a bag of food and that we aren't stranded without food. I do not want to pay for a bag of food every 2 weeks.