This knowledge base article documents how to calculate Percentage to Total in a metric subtotal in MicroStrategy Developer 9.4.x-10.x.
In some business scenarios, it is required to calculate the value of Percentage to Total in a metric subtotal, as shown below:
For the steps below to achieve the requirement in Tutorial project:
In Strategy Developer, create a Subtotal object, and input the expression, as shown below:
Sum(( x / Sum(x) {} )) {@}
NOTE: The of the inner Sum() is removed by deleting "@", while the outer one is kept.
Save the subtotal object as "Percent to Total".
Edit the metric that is required to display the percentage subtotal. Add the subtotal created in the previous steps to the right window to be available for this metric, as shown below:
Save and close the metric editor.
Create a report with attributes and , and metric .
Go to Menu -> Data -> Subtotals, and select to enable the new subtotal, as shown below:
Go to Menu -> Format, to set the format of subtotal values to be Percent, as shown below:
Save and run the report. The subtotal can calculate the percentage to total, as shown at the top of this technical note.