new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
licenseFilePath: "https://cdn.flexmonster.com/jsfiddle.charts.key",
height: 400,
report: {
"dataSource": {
"type": "microsoft analysis services",
"proxyUrl": "https://olap.flexmonster.com:8085/",
"catalog": "Adventure Works DW Standard Edition",
"cube": "Adventure Works",
"binary": true
},
"slice": {
"rows": [{
"uniqueName": "[Geography].[City]"
}],
"columns": [{
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "[Measures].[Discount Amount]"
}]
},
"options": {
"showMemberProperties": true
},
"version": "2.9.33",
"creationDate": "2022-09-12T13:20:02.746Z"
}
});
function greaterFilter(num) {
let topCounter = 0;
/*
Use the getData API call to retrieve the raw data from the grid.
NOTE: this approach iterates through the data loaded from the cube on the client's machine, so using it with big datasets will slow the performance.
*/
flexmonster.getData({},
(rawData) => {
//Find how many values are bigger than "num", which will allow simulating the "Greater" filter with the "Top" filter
topCounter = rawData.data.filter(obj => {
/*
r0 !== undefined - excludes grand total
obj.v0 > num - checks if the value is greater than "num"
(number after "v" stands for index of the measure in Measures[] array)
*/
return obj.r0 !== undefined && obj.v0 > num;
}).length;
},
(rawData) => {
/* In this case, second callback function is not needed */
}
);
/*Apply Top filter*/
flexmonster.setFilter("[Geography].[City]", {
"measure": {
"uniqueName": "[Measures].[Discount Amount]",
"aggregation": "none"
},
"query": {
"top": topCounter
}
})
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.