Add and Update Calculated Measures

Add and Update Calculated Measures

Resources

Below is an example of JSON structure which can be used as a reference for the measuresJson parameter in the request body.

{ "measureName1":{ "expression":"[Measures].[Amount]*[Measure].[ID]", "description":"description1", "groupName":"MeasureGroup", "groupDescription":"groupDescription1", "solveOrder":"1", "formatType":"Number", "format":"#,##0.00", "isVisible":false, "nonEmptyBehaviour":"BY_MEASURE", "nonEmptyMeasures":"ID" } }

JSON Fields Description

Field

Type

Description

Possible Values

Example

(root)

Array

Root JSON array containing verified query definitions. Each object represents a verified query for AI/conversational interfaces

Array of VerifiedQuery objects

[{...}]

id

String

Unique identifier for this verified query. Required for UPDATE and DELETE actions. Auto-generated for new queries if not provided

GUID or empty for new queries

"query_17764122062715"

question

String

The natural language question that users might ask. This is the query text that the AI will recognize and match against user questions. Must be unique within the semantic model

Any natural language question

"What are the total sales by region?"

sql

String

The SQL query that should be executed when this question is asked. This is the verified/approved SQL that produces the correct answer for the question

Valid SQL query

"SELECT region, SUM(sales) FROM sales_fact GROUP BY region"

context

String

Additional context or description for the query. Helps AI understand when to use this query and provides metadata for documentation. Can be empty

Free-form text or empty

"Use this for regional sales analysis"

action

String

The action to perform on this verified query. ADD creates a new query, UPDATE modifies an existing query, DELETE removes a query

"add","update","delete"

"add"

isSampleQuestion

Number

Whether this query should be shown as a sample question to users in the AI interface. 1=show as sample, 0=don't show as sample

0,1

1

origin

Number

Origin of the query. 0=user-created through API/UI, 1=system-generated or imported. System-generated queries may have different handling

0,1

0

visibility

JSON Object

Controls which users and groups can see and use this verified query. If not specified, query is visible to all users with access to the semantic model

-

{...}

visibility.users

Array

Array of user identifiers who can see this verified query. Empty array means no user-specific restrictions

Array of user ID strings

["user_123", "user_456"]

visibility.groups

Array

Array of group identifiers who can see this verified query. Empty array means no group-specific restrictions

Array of group ID strings

["group_789", "group_012"]

Additional Details of JSON Example

Format Type

The formatType field can be provided either as a string or as a numerical value based on the following mapping:

  • 2 – Number

  • 3 – Currency

  • 4 – Date

  • 5 – Time

  • 6 – Percentage

  • 7 – Scientific

  • 9 – Custom

  • 10 – Duration

Non-Empty Behaviour

The nonEmptyBehaviour field determines how the system evaluates whether a calculated measure is empty. Supported values include:

  • BY_EXPRESSION
    The expression itself is evaluated to determine if the calculated measure is empty.

  • BY_MEASURE
    The calculated measure is treated as empty if all the specified measures are empty.

  • BY_MEASURE_THEN_EXPRESSION
    The calculated measure is treated as empty if all specified measures are empty, or if the evaluated expression is empty.

 

Copyright Kyvos, Inc. 2026. All rights reserved.