7 Replies Latest reply on Jun 28, 2017 3:48 AM by Okechukwu Ossai

# Need URGENT help to calculate material shipped in range of Days.

I have data where where materials are shipped within 0-1, 1-2 days. I would need help to create bins to calculate or create a graph as below.

In below example - Total material shipped for franchise1 between 0-1 is 7862. Need help to create this in tableau.

 Days Franchise1 Franchise2 Franchise3 Franchise4 0-1 7826 6776 3834 6483 1-2 497 916 150 139 2-3 177 207 43 15 3-4 87 64 8 7 >4 30 49 8 2

• ###### 1. Re: Need URGENT help to calculate material shipped in range of Days.

Hi Parag,

Are you after something like this?

Regards,

Oin

1 of 1 people found this helpful
• ###### 2. Re: Need URGENT help to calculate material shipped in range of Days.

Hi Oin,

Yes. Perfect. Can you help me with the calculation.

• ###### 3. Re: Need URGENT help to calculate material shipped in range of Days.

It's easier to use flat data instead of pivot

• ###### 4. Re: Need URGENT help to calculate material shipped in range of Days.

Hi Parag,

I have created a excel sheet with the data set you have given and connected to that source.

No calculations have been created. You can refer to the image I shared for the dragging and dropping of fields of the data source into the view

PFA the workbook for reference

Thanks,

Oin

• ###### 5. Re: Need URGENT help to calculate material shipped in range of Days.

Hi Parag,

I assume you have shipping duration in days already calculated in your database. If not, you need to calculate that first. Let's call that field [Duration].

1. Create calculated field [Days]

IF [Duration] >= 0 AND [Duration] < 1 THEN "0-1"

ELSEIF [Duration] >= 1 AND [Duration] < 2 THEN "1-2"

ELSEIF [Duration] >= 2 AND [Duration] < 3 THEN "2-3"

ELSEIF [Duration] >= 3 AND [Duration] <= 4 THEN "3-4"

ELSE ">4"

END

2. Create your chart. It seems you want to create a stacked bar chart that adds up to 100% instead of a normal bar chart. If yes, the link below will be a useful resource.

Creating a Stacked Bar Chart That Adds up to 100% | Tableau Software

3. If you require help on how to calculate [Duration] in days, you can use the formula template below

DATEDIFF('day', [Start Date], [End Date])

Hope this helps.

Ossai

• ###### 6. Re: Need URGENT help to calculate material shipped in range of Days.

Hi Thanks for the reply however we have  a database where days are not mentioned as a separate entity. That's the reason need some calculation for this.

1 of 1 people found this helpful
• ###### 7. Re: Need URGENT help to calculate material shipped in range of Days.

Hi Parag,

I already gave you all the calculations that you will need in my previous response in 3 suggested steps.

Step 3 shows you how to calculate duration in days if you don't have that in the database.

Step 1 shows you how to calculate Days as bins.

Finally, Step 2 shows you how to create your chart.

Hope this helps.

Ossai