JSFiddle - React, Tailwind, and code Playground
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/",
width: "100%",
height: 430,
toolbar: true,
report: {
dataSource: {
dataSourceType: "json",
data: [
{
"visit": "v1",
"patient": "p1",
"type": "t1",
"own": 1
},
{
"visit": "v2",
"patient": "p1",
"type": "t1",
"own": 1
},
{
"visit": "v3",
"patient": "p2",
"type": "t1",
"own": 0
},
{
"visit": "v4",
"patient": "p3",
"type": "t1",
"own": 1
},
{
"visit": "v5",
"patient": "p4",
"type": "t2",
"own": 1
},
{
"visit": "v6",
"patient": "p5",
"type": "t2",
"own": 0
},
]
},
slice: {
rows: [{uniqueName: "type"}],
columns: [{uniqueName: "[Measures]"}],
measures: [
{
"uniqueName": "uniquePatientCount",
"formula": "distinctcount('patient')",
},
{
"uniqueName": "uniqueOwnPatientCount",
"formula": "if('own' == 1, distinctcount('patient'), )"
},
{
"uniqueName": "uniquePortalPatientCount",
"formula": "if('own' == 0, distinctcount('patient'), )"
}
],
}
}
});