# Custom calculations in decomposition tree

For the decomposition tree, **data gets aggregated in the extension**. Thats why pre-aggregated fields like AGG(Profi Ratio) **are not allowed** to be used in the extension.

<figure><img src="https://2268858626-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxF3J9z75cLxrADGYFAvj%2Fuploads%2FtnddbobP7M63fliNI0QM%2Fdecomp_tree_error.png?alt=media&#x26;token=59de7a83-07d2-498a-81d0-a7848f44a850" alt=""><figcaption><p>Decomposition Tree: Warning when using aggregated measures</p></figcaption></figure>

To decompose calculations like a Profit Ratio, they **have to be calculated in the extension**. You can do this in the **Custom Calculations** section. All parts of the calculation have to be present in the **Measure Values shelf.**

<figure><img src="https://2268858626-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxF3J9z75cLxrADGYFAvj%2Fuploads%2FfrWbH2YuUDxu62zEkoHX%2FcustomCalc.gif?alt=media&#x26;token=bac4a8fd-b8c1-4558-b6c4-68d5bd4672f7" alt=""><figcaption><p>Custom Calculations in Decomposition Tree</p></figcaption></figure>
