Create a metric with advanced properties

POST {{baseUrl}}/api/model/metrics?showExpressionAs=tree&showFilterTokens=true&showAdvancedProperties=true

Request Params

KeyDatatypeRequiredDescription
showExpressionAsstringThis parameter specifies the format in which the expressions are returned in response.

This parameter applies to the expressions in a fact or attribute and custom expressions used in a filter, prompt, security filter, custom group, etc.

Expressions are presented in the following formats:

"text": A human readable, but non-parsable text, describing the expression. This is the default format that is always returned in the response.

"tree": A tree data structure fully defining the expression. This format can be used if you want to examine and modify the expression programmatically.

"tokens": A list of parsed tokens. This format can be used if you want to examine and modify the expression using the parser component. Note that generating tokens requires additional time.

Tokens are a semi-structured representation of MicroStrategy expression text that includes object references. For example, let’s say a filter expression is "Revenue > Cost". When the filter expression is represented as tokens, the text is broken down into pieces (tokens) with information about what these pieces represent in the metadata: ("Revenue", Revenue_ID), (">", GreaterThan_ID), ("Cost", Cost_ID).

If omitted, the expression is returned in "text" format.

If tree, the expression is returned in "text" and "tree" formats.

If tokens, the expression is returned in "text" and "tokens" formats.

Available values : tokens, tree | | showFilterTokens | boolean | | Specify whether the "condition" in threshold is returned in "tokens" format, along with "text" and "tree" formats.

The "condition" in threshold is presented in the following formats:

"text": A human readable, but non-parsable text, describing a condition's qualification. "tree": A tree data structure fully defining the condition's qualification. "tokens": A list of parsed tokens that define a condition's qualification. Be aware that generating tokens requires additional time. If omitted or false, only "text" and "tree" formats are returned.

If true, all "text", "tree" and "tokens" formats are returned. | | showAdvancedProperties | boolean | | Specify whether the metric’s definition is returned with advanced properties. If omitted or false, the advanced properties are not returned. If true, the advanced properties are are returned. |

Request Body

{"information"=>{"subType"=>"metric", "name"=>"test_sample_metric", "destinationFolderId"=>"{{publicReportsFolderId}}"}, "expression"=>{"tokens"=>[{"value"=>"sum([Item inventory])"}]}, "dimty"=>{"dimtyUnits"=>[{"dimtyUnitType"=>"report_base_level", "aggregation"=>"normal", "filtering"=>"apply", "groupBy"=>true}], "excludeAttribute"=>false, "allowAddingUnit"=>true}, "conditionality"=>{"filter"=>{"objectId"=>"E638359211D5C49EC0000C881FDA1A4F", "subType"=>"filter", "name"=>"Select a Quarter"}, "embedMethod"=>"metric_into_report_filter", "removeElements"=>true}, "metricSubtotals"=>[{"definition"=>{"objectId"=>"96C487AF4D12472A910C1ACACFB56EFB", "subType"=>"system_subtotal", "name"=>"Total"}, "implementation"=>{"objectId"=>"B328C60462634223B2387D4ADABEEB53", "subType"=>"system_subtotal", "name"=>"Average"}}, {"definition"=>{"objectId"=>"078C50834B484EE29948FA9DD5300ADF", "subType"=>"system_subtotal", "name"=>"Count"}}, {"definition"=>{"objectId"=>"B328C60462634223B2387D4ADABEEB53", "subType"=>"system_subtotal", "name"=>"Average"}}, {"definition"=>{"objectId"=>"00B7BFFF967F42C4B71A4B53D90FB095", "subType"=>"system_subtotal", "name"=>"Minimum"}}, {"definition"=>{"objectId"=>"B1F4AA7DE683441BA559AA6453C5113E", "subType"=>"system_subtotal", "name"=>"Maximum"}}, {"definition"=>{"objectId"=>"F225147A4CA0BB97368A5689D9675E73", "subType"=>"system_subtotal", "name"=>"Aggregation"}, "implementation"=>{"objectId"=>"078C50834B484EE29948FA9DD5300ADF", "subType"=>"system_subtotal", "name"=>"Count"}}], "aggregateFromBase"=>false, "formulaJoinType"=>"inner", "smartTotal"=>"decomposable_false", "dataType"=>{"type"=>"int64", "precision"=>0, "scale"=>0}, "format"=>{"header"=>[{"type"=>"number_category", "value"=>"0"}, {"type"=>"number_decimal_places", "value"=>"2"}, {"type"=>"number_thousand_separator", "value"=>"true"}, {"type"=>"number_currency_symbol", "value"=>"$"}, {"type"=>"number_currency_position", "value"=>"0"}, {"type"=>"number_format", "value"=>"#,##0.00;(#,##0.00)"}, {"type"=>"number_negative_numbers", "value"=>"3"}, {"type"=>"background_fill_color", "value"=>"3355443"}, {"type"=>"background_pattern_style", "value"=>"1"}, {"type"=>"background_fill_style", "value"=>"0"}, {"type"=>"background_gradient_angle", "value"=>"0"}, {"type"=>"background_gradient_x_offset", "value"=>"0"}, {"type"=>"series_fill_style", "value"=>"0"}, {"type"=>"series_fill_color", "value"=>"8388608"}, {"type"=>"series_gradient_angle", "value"=>"0"}, {"type"=>"series_gradient_x_offset", "value"=>"0"}], "values"=>[{"type"=>"number_category", "value"=>"0"}, {"type"=>"number_decimal_places", "value"=>"0"}, {"type"=>"number_format", "value"=>"#,##0;(#,##0)"}]}, "subtotalFromBase"=>false, "columnNameAlias"=>"test", "metricFormatType"=>"reserved", "advancedProperties"=>{"vldbProperties"=>{"AnalyticalEngineProperties"=>{"."=>{"NullCheckingForAnalyticalEngine"=>{"name"=>"NullCheckingForAnalyticalEngine", "type"=>"int32", "value"=>"2", "resolvedLocation"=>"default", "isInherited"=>true}, "SubtotalDimensionalityAware"=>{"name"=>"SubtotalDimensionalityAware", "type"=>"boolean", "value"=>"true", "resolvedLocation"=>"default", "isInherited"=>true}}}, "VLDB Function"=>{"."=>{"Null Check"=>{"name"=>"Null Check", "type"=>"int32", "value"=>"2", "resolvedLocation"=>"default", "isInherited"=>true}, "Zero Check"=>{"name"=>"Zero Check", "type"=>"int32", "value"=>"1", "resolvedLocation"=>"default", "isInherited"=>true}}}, "VLDB Report"=>{"."=>{"Count Distinct with Partitions"=>{"name"=>"Count Distinct with Partitions", "type"=>"int32", "value"=>"0", "resolvedLocation"=>"default", "isInherited"=>true}}}, "VLDB Select"=>{"."=>{"Integer Constant In Metric"=>{"name"=>"Integer Constant In Metric", "type"=>"int32", "value"=>"1", "resolvedLocation"=>"dbms", "isInherited"=>true, "nextValue"=>"0", "nextResolvedLocation"=>"default"}, "Metric Join Type"=>{"name"=>"Metric Join Type", "type"=>"int32", "value"=>"0", "resolvedLocation"=>"default", "isInherited"=>true}, "No Nulls In Metric For Cube Reuse"=>{"name"=>"No Nulls In Metric For Cube Reuse", "type"=>"int32", "value"=>"0", "resolvedLocation"=>"default", "isInherited"=>true}, "Smart Metric Transformation"=>{"name"=>"Smart Metric Transformation", "type"=>"int32", "value"=>"0", "resolvedLocation"=>"default", "isInherited"=>true}, "Transformable AggMetric"=>{"name"=>"Transformable AggMetric", "type"=>"int32", "value"=>"0", "resolvedLocation"=>"default", "isInherited"=>true}, "Use Subtotal Dimty for Dynamic Aggregation"=>{"name"=>"Use Subtotal Dimty for Dynamic Aggregation", "type"=>"int32", "value"=>"0", "resolvedLocation"=>"default", "isInherited"=>true}}}}}}

HEADERS

KeyDatatypeRequiredDescription
X-MSTR-AuthTokenstring(Required)
X-MSTR-MS-Changesetstring(Required)