In MicroStrategy, thresholds are typically applied to a metric or an attribute at a template level. MicroStrategy now supports attribute thresholding in version 10.4 for Web. This architecture presents certain challenges in self-service reporting.
If we look at the object model, a threshold object in MicroStrategy would consist of:
-- An expression that defines the condition of the threshold
-- A format object that applies the formatting when the expression condition is met
We could have an expression similar to Category@ID > 2 and a format object that makes the font bold. Thus in any report where the Category attribute exists, the threshold can be applied to a metric on the template. However the scope of that threshold is applicable for that template only as shown in below...
Now in a self-service scenario, if you're dealing with a combination of a lot of metrics and thresholds, you will have to recreate all your conditional formatting manually and apply it at the template level. MicroStrategy hasn't yet defined the threshold object as a first-class object (standalone object) that can be reused so you're essentially rewriting all the threshold expressions.
Here's where we can leverage MicroStrategy's Server (COM) API. These are very powerful set of APIs that can allow you to do more than what you would typically with the Web API. Using the COM API, we can programmatically create thresholds by building an expression object and a format object. This threshold object can then be applied to a metric object*. The interface you can use in COM API is the IDSSMetric6 along with IDSSThreshold for creating the threshold object. This will allow us to apply each threshold to a standalone metric as shown below...
This would allow users who are running ad-hoc or self-service reports the ability to add metrics that would already contain the necessary thresholds and the formatting would be applied if the other template objects selected by the user would satisfy the expression. For example if the user chooses to add Category to his template at run-time along with the Revenue metric and if the Revenue metric has a threshold applied to it, you would see the formatting applied. This would work on any template that the Revenue is added to, regardless of whether you have thresholds applied at the template level.
As you can see from the screenshot below, I have applied a threshold that makes the Rev1 value bold if the Category ID > 2. However, as you can see, the template threshold is empty. In this case the threshold is applied to the Rev1 metric object.
This metric will carry over the threshold logic on any template that it is placed.
*The COM API currently does not support applying thresholds to standalone attributes. They can only be applied to metrics.