# How to automatically calculate the size of a variant

To make a rule that will calculate the volume of a [variant](https://docs.struct.com/fundamental-concepts/products-and-variants) based on the dimensions of that [variant](https://docs.struct.com/fundamental-concepts/products-and-variants), make a [trigger](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/triggers/trigger-details) that [triggers](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/triggers/trigger-details) when any of the dimensions change.

<figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2FeBxgHWnrpLYa5OFXN40l%2Fimage.png?alt=media&#x26;token=eb869714-f8a5-4aed-8a40-a35cbd355647" alt=""><figcaption><p>Setup trigger</p></figcaption></figure>

Then add an [action](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/actions/action-details) and choose "Calculate value". When configuring the [action](https://docs.struct.com/reference/settings/data-governance/business-rules/business-rule-details/actions/action-details) click "Add math calculation" and choose "Add math operation".\
\
In this example we start by multiplying the height and width. That result is then multiplied with the length. Finally that result is multiplied with 0,001 to make sure the units are correct.&#x20;

<figure><img src="https://2141378775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUonpFWM7AJ0xVVXV1tr%2Fuploads%2Fsevj3yd0p03EVoatJKuo%2Fimage.png?alt=media&#x26;token=e9912862-2a89-408b-b1a3-008eebe7620d" alt=""><figcaption><p>Configure action</p></figcaption></figure>

Finally choose what [attribute](https://docs.struct.com/fundamental-concepts/attributes) the result should be written to.

{% hint style="info" %}
**Note** By clicking the operator between the values you can choose the operator (x,/,+,-).
{% endhint %}
