Add calculated measure with individual property
Calculated measures
by Flexmonster Pivot Table
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>
JavaScript
var pivot = new Flexmonster({
"container": "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
"toolbar": true,
"height": "100%",
"width": "100%",
"report": {
"dataSource": {
data: [
{
"Country" : "Canada",
"gpaValue" : 4.0,
"gpaWeight" : 0.5,
"gpaValueXgpaWeight": 2.0
},
{
"Country" : "Canada",
"gpaValue" : 2,
"gpaWeight" : 1.0,
"gpaValueXgpaWeight": 2.0
}
]
},
slice: {
"rows": [
],
"columns": [{
"uniqueName": "[Measures]"
}],
"measures": [
{
"uniqueName": "gpa",
"formula": "sum(\"gpaValueXgpaWeight\") / sum(\"gpaWeight\") ",
"caption": "GPA",
"format": "decimal"
},
{
"uniqueName": "gpaValueXWeightCalc",
"individual": true,
"formula": "sum(\"gpaValue\") * sum(\"gpaWeight\") ",
"caption": "GPAxweight",
"format": "decimal"
},
{
"uniqueName": "gpa2",
"formula": "\"gpaValueXWeightCalc\" / sum(\"gpaWeight\") ",
"caption": "GPA2",
"format": "decimal"
}
]
},
"formats": [{
"name": "",
"thousandsSeparator": "",
"decimalSeparator": ".",
"currencySymbol": "",
"currencySymbolAlign": "left",
"nullValue": "",
"textAlign": "right",
"isPercent": false
},
{
"name": "wholeComma",
"thousandsSeparator": ",",
"decimalSeparator": ".",
"currencySymbol": "",
"currencySymbolAlign": "left",
"nullValue": "",
"textAlign": "right",
"isPercent": false
},
{
"name": "decimal",
"thousandsSeparator": "",
"decimalSeparator": ".",
"decimalPlaces": 2,
...