# ALL Calculation Query

Hi All,

I have a table of Orders with a Related Date Table and Reasons Table which is a table that has reasons for Failure.

I have a Base Failure Measure -

`Orders Failed = CALCULATE([Orders Dispatched], FILTER(Orders, Orders[Reason] <> ""))`

An Orders Dispatched measure that gives me the number of all Orders that are Dispatched in the Current Context.

`Orders Dispatched = DISTINCTCOUNT(Orders[Order Reference])`

I then try to Calculate the Failure % against the dispatched with the following Failure % = DIVIDE([Orders Failed], [All Orders Dispatched], 0) which is fine until I put the Reason Type on the Pivot where I then get 100%.

Am I correct in thinking that I would need an All Reasons Orders Dispatched to keep any Date Context but ignore the Reasons.

Such as - `All Orders Dispatched = CALCULATE([Orders Dispatched], ALL(Orders[Reason]))`

Hopefully this will make sense.

Hi Chris, can you place an image of the calculation and the data model also. I just want to see the evaluation context and where it’s coming from in the model

Hi Sam

Calcs

``````Orders Dispatched = DISTINCTCOUNT(Orders[Order Reference])
Failure % = DIVIDE([Orders Failed], [All Orders Dispatched], 0)
All Orders Dispatched = CALCULATE([Orders Dispatched], ALL(Reason)) - Should this not be Orders[Reason]
``````

I would have honestly thought you would get the same result. What is the evaluation or initial context the the result is in?

Is it date? or something else.

You would use ALL(Reason) if you wanted to remove any of the filters from the Reason table. If you narrow it to only a specific column you will ONLY remove a filter from that column based on the initial context of the calc.