MicroStrategy Metric With a Constant Text or Number Value

Icon - LocationHOME
/
BLOG
/
MicroStrategy Constant Metric
Icon - Astronaut
By
Adonis Salazar
Icon - Calendar
Updated
September 4, 2023
Icon - Categories
Categories

A neat solution I discovered when I first began working with MicroStrategy was how to create a metric with a fixed value. I am a big fan of this solution because the fixed metric value is calculated by the MicroStrategy Analytical Engine after the SQL query is executed against the data warehouse. Compared to other solutions which are table based, this solution will not create any unwanted cross joins in the report SQL query.

In the past, I have used this solution for calculating budgets, inventory shrinkage, forecasting, thresholds, data visualization hacks where a text was required for a metric, and any other requirements where a constant metric value of a text or number was required.

To create a metric with a fixed NUMBER value, copy and paste the pass-through expression code below into your metric definition. To change the metric number value from 7%, update the 0.07 to your desired value.

ApplySimple("#0", 0.07)

MicroStrategy metric with a fixed forecast of 7%

To create a metric with a fixed TEXT value, copy and paste the pass-through expression code below into your metric definition. To change the metric text value from ABCDEFG, update the ABCDEFG to your desired value. Under the Subtotals / Aggregation tab, don't forget to set the Total subtotal function to Maximum in order to display the text value as a total in your grid(s).

ApplySimple(" 'ABCDEFG' ", 0)

MicroStrategy metric with a fixed string value of ABCDEFG

Sources: KB11508 and KB5221

Icon - Scroll to Top