microstrategy

Microstrategy report IF statement


In a Microstrategy report is there a way to create an IF statement off of a condition on the attribute not a metric so that it looks like the table below? If(Unique ID Attribute = "Test1", 0, 1)

Unique_ID Attribute Metric Output from If Statement
Test1 0
Test2 1
Test3 1

Solution

  • You have to convert the attribute to a metric first. You can use "Max([Unique_ID Attribute]){~+}" for this, and call it "MAX UNIQUE_ATTR" With this metric you can then use your IF statement: IF(([MAX UNIQUE_ATTR] = "Test1"), 1, 0)

    You don't have to use two metrics, you could write this inside a single metric too. Depends on whether you want to re-use said MAX-metric. Also think about subtotals/dynamic aggregation and what it should show there (sum/avg).

    All the other options for metrics still apply, you can use filters, manually set the levels of the metric etc.

    I've included a screenshot I did on a testproject.

    enter image description here