Need a special offer?Find out if your project fits.
+

Can measures be in the report definition?

Answered
Tom Ray asked on November 20, 2020

Can measures and calculations be inside of the report definition instead of the slice definition?

1 answer

Public
Vera Didenko Vera Didenko Flexmonster November 23, 2020

Hello, Tom,
 
Thank you for writing to us. 
 
We would like to kindly explain that measures and calculated measures are defined in the slice object, which is part of the report definition.
 
In case you would like to define calculated measures without displaying them on the grid:
This can be achieved by specifying "active": false in the measure definition, for example: 

"slice": {
"rows": [{"uniqueName": "Category"}],
"measures": [
{
"uniqueName": "Price",
"aggregation": "sum"
},
{
"uniqueName": "Price Average",
"formula": "average(\"Price\")",
"caption": "Price Average",
"active": false
},
{
"uniqueName": "Size Count",
"formula": "count(\"Size\")",
"caption": "Size Count",
"active": false
}
]
}

As a result, "Price Average" and "Size Count" won't be displayed on the grid by default, but they could be selected in the Field List.
Here is a JSFiddle for illustration: https://jsfiddle.net/flexmonster/r7yj1c0t/.
 
 
Please let us know if this helps. 
Looking forward to your reply.
 
Kind regards, 
Vera

Please login or Register to Submit Answer