count conditional

How could I count the values that meet a condition? I speak of alphanumeric conditions. I have tried with an example of yours but I can not mount it correctly:
var jsondata = [{
“Color”: “green”,
“M”: “September”,
“W”: “Wed”,
“country”: “Canada”,
“state”: “Ontario”,
“city”: “Toronto”,
“Price”: 174,
“Quantity”: 22,
“Svc Cd”: 125
}, {
“Color”: “red”,
“M”: “March”,
“W”: “Mon”,
“Time”: “1000”,
“country”: “USA”,
“state”: “California”,
“city”: “Los Angeles”,
“Price”: 30,
“Quantity”: 19,
“Svc Cd”: 124
var pivot = new Flexmonster({
container: “pivot-container”,
componentFolder: “”,
width: “100%”,
height: 430,
toolbar: true,
report: {
dataSource: {
data: jsondata
slice: {
pages: [{uniqueName: “city”}],
rows: [{uniqueName: “Color”}],
columns: [{uniqueName: “[Measures]”}],
measures: [{uniqueName: “city”}, {uniqueName: “Formula #1”, caption: “Formula #1”, individual: true, formula: “if(sum(‘city’) == ‘Los Angeles’, 1, 2)”, active: true}]
formats: [{name: “”, nullValue: “blank”}]

3 answers

Iryna Kulchytska Flexmonster 3 days ago

Hi Jose Antonio,
Thank you for posting your question.
The comparison with string value like “Los Angeles” is not available in calculated values. When using string hierarchies in calculated values, you can use only count aggregation and compare it with numbers.
Also, the following thread on our forum can be useful for your case:
Please let me know if you have any questions.
Kind regards,

Jose Antonio Veintimilla 3 days ago

If it seems good, I send you a screen dump of the final result that I am trying to obtain. In case you could give me some help for this case:
var nominal = [{“idReg”:”393465″,”codigoCamp”:”0001″,”descCamp”:”description1″,”finca”:”one”,”estado”:”Pendiente”,”CUPS”:”ES0217010029647071HX”},
pivot = new Flexmonster({
container: “pivotContainer”,
componentFolder: “assets/js/plugins/flexmonster/”,
//global: {
// localization: “es.json”
width: “100%”,
height: 640,
toolbar: true,
report: {
localization: es,
dataSource: {
dataSourceType: “json”,
data: nominal
options: {
datePattern: “DD/MM/yyyy”
slice: {
pages: [
{ uniqueName: “codigoCamp”, caption: “Código Campaña” },
{ uniqueName: “estado”, caption: “Estado” },
{ uniqueName: “finca”, caption: “Finca” }
rows: [
{ uniqueName: “descCamp”, caption: “Campaña” }
columns: [
{ uniqueName: “estado”, caption: “Estado” }
measures: [
{ uniqueName: “CUPS”, caption: “Cuenta”, formula:”count(‘CUPS’)”, active: true }
expandAll: true,
drillAll: true,
licenseKey: “hidden”,
beforetoolbarcreated: customizeToolbar


Tanya Gryshko Flexmonster 2 days ago

Hello, Jose Antonio,
Thanks for the quick reply and providing your data source.
Could you please share some additional details about the final result you’re trying to achieve?

Please login or Register to Submit Answer