Coefficient of variation
Calculated measures
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>
CSS
@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);
JavaScript
let pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
data: getData()
},
"slice": {
"rows": [{
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "Height",
"aggregation": "stdevp",
"grandTotalCaption": "SD of Height"
},
{
"uniqueName": "CV of Height",
"formula": "stdevp(\"Height\") / average(\"Height\") ",
"caption": "CV of Height",
"format": "2vps40e7"
}
]
},
"formats": [{
"decimalPlaces": 2
},
{
"name": "2vps40e7",
"isPercent": true
}
]
}
});
function getData() {
return [{
"Employee": "Employee 01",
"Height": 180,
"Age": 29,
"Monthly Salary": 1000
},
{
"Employee": "Employee 02",
"Height": 170,
"Age": 25,
"Monthly Salary": 900
},
{
"Employee": "Employee 03",
"Height": 156,
"Age": 24,
"Monthly Salary": 1300
},
{
"Employee": "Employee 04",
"Height": 167,
"Age": 34,
"Monthly Salary": 1200
},
{
"Employee": "Employee 05",
"Height": 173,
"Age": 40,
"Monthly Salary": 1200
},
{
"Employee": "Employee 06",
"Height": 163,
"Age": 32,
"Monthly Salary": 1500
},
{
"Employee": "Employee 07",
"Height": 189,
"Age": 31,
"Monthly Salary": 3500
},
{
"Employee": "Employee 08",
"Height": 192,
"Age": 20,
"Monthly Salary": 2800
},
{
"Employee": "Employee 09",
"Height": 159,
"Age": 28,
"Monthly Salary": 1400
},
{
"Employee": "Employee 10",
"Height": 167,
"Age": 27,
"Monthly...