# Subtraction of overallocation from day before

**giulia.bartoletti**Feb 12, 2018 1:25 AM

Hello everyone,

I am pretty new in working with Tableau ( 1month) and i can't come up with a solution for my problem. I know it will be better to add few data, but unfortunately i can't share it.

**Data: **from different origin of goods and different destinations there is a limit **per week** **and per day** of how much weight is possible to have.

*For example. Origin Russia and destination FR is 100Ton, Origin Russia and destination USA is 80ton, Origin China and destination USA is 150ton etc. etc. *

* * Calculation Field (1) done as following:* IF [Origin] AND [Destination] THEN 100*

* ELSE IF [Origin] AND [Destination] THEN 200 *

*Calculation Field (1) in Reference Line as Minimum. this is the bar chart that i got (just 2 lines as example): *

*Dest. country - axes Weight (in ton) and the reference line showing the limit. This Table is ok.*

* 1. Question: *I would like to have in red the one that the limit for the week has been over exceed. I tried to do calculation: [weight]>calculation field (1) THEN 0 ELSE 1 but it doesn't work. it just give me 1 while there should be also 0. How can I do it?

**Data:** Limitation **per day** is kind similar to the week limitation but if for example Origin Russia and Destination USA we have per day 50 ton max of weight:

Mon 45 ton

Tue 55 ton

Wed (we will have only 45ton available and not 50 because the day before we got more then the limit per day).

**2. Question: **I would like to show when per day we exceed the limit but considering that they have to: [day before exceed limit] - [the limit per day]. Following the example before 55 (of tuesday) - 50 (the limit per day)=5 on Wed i have as a limit 45. I tried to do the calculation but instead of doing the sum[weight]*that day (only monday for example). it did it per each rows. ** **

**3. Question: **there is a way to show in tableau on the axis week day, where for every origin and destination, showing me in which **day** the limit has exceed (grey colour no, red one exceed) and also a line on when in that **week** the limit weight per week has been exceed too?

I imagined like this:

I hope my questions are clear. I really appreciate anyone who would like to help me.

Thank you,

Giulia