# `Ash.Query.Calculation`
[🔗](https://github.com/ash-project/ash/blob/v3.23.1/lib/ash/query/calculation.ex#L5)

Represents a calculated attribute requested on a query

# `t`

```elixir
@type t() :: %Ash.Query.Calculation{
  async?: term(),
  calc_name: term(),
  constraints: term(),
  context: term(),
  filterable?: term(),
  load: term(),
  module: term(),
  multitenancy: term(),
  name: term(),
  opts: term(),
  required_loads: term(),
  select: term(),
  sensitive?: term(),
  sortable?: term(),
  type: term()
}
```

# `from_resource_calculation`

Creates a new query calculation from a resource calculation.

## Options

* `:args` (`t:map/0`) - Arguments to pass to the calculation The default value is `%{}`.

* `:source_context` (`t:map/0`) - Context from the source query or changeset. The default value is `%{}`.

# `from_resource_calculation!`

Creates a new query calculation from a resource calculation, raising any errors.

See `from_resource_calculation/3` for more.

# `new`

Creates a new query calculation.

## Options

* `:arguments` (`t:map/0`) - Arguments to pass to the calculation The default value is `%{}`.

* `:async?` (`t:boolean/0`) - Whether or not this calculation should be run asynchronously The default value is `false`.

* `:filterable?` (`t:boolean/0`) - Whether or not this calculation can be filtered on The default value is `true`.

* `:sortable?` (`t:boolean/0`) - Whether or not this calculation can be sorted on The default value is `true`.

* `:sensitive?` (`t:boolean/0`) - Whether or not references to this calculation will be considered sensitive The default value is `false`.

* `:load` (`t:term/0`) - Loads that are required for the calculation.

* `:actor` (`t:term/0`) - The actor performing the calculation.

* `:tenant` (`t:term/0`) - The tenant performing the calculation.

* `:authorize?` (`t:boolean/0`) - Whether or not authorization is being performed

* `:tracer` (`t:term/0`) - The tracer or tracers used in the calculation.

* `:source_context` (`t:map/0`) - Context from the source query or changeset. The default value is `%{}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
