Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
dselgo_eidex
Partner - Creator III
Partner - Creator III

Help with qCalcCond on measure

Hello, I am trying to define a hyper cube, and I want to set a calculation condition on a measure. Right now I have the following:

"qMeasures": [

  {

   "qDef": {

   "qLabel": "Foo",

   "qGrouping": "N",

   "qDef": "Bar",

   "qNumFormat": {

   "qType": "F",

   "qnDec": 2,

   "qUseThou": 0,

   "qFmt": "0.0%",

   "qDec": ".",

   "qThou": ","

  },

   "autoSort": true,

   "cId": "JXKjkd",

   "numFormatFromTemplate": true,

   "isCustomFormatted": false

  },

   "qSortBy": {

   "qSortByNumeric": -1,

   "qSortByLoadOrder": 1,

   "qExpression": {}

  },

   "qCalcCond": {

   "qv": "0"

  },

   "qCalcCondition": {

   "qCond": {

   "qv": "0"

  },

   "qMsg": {}

  }

  },

...

]

I have other measures in my hypercube definition, but I'm setting the calc condition of this one to 0 to see if I can get it to stop displaying.

I'm trying to create a pivot table with measures that will not calculate based on a variable I pass to qHyperCubeDef. However, when I set this measure to 0 to not calculate, the entire pivot table does not calculate. I get the following error in my console: "TypeError: Cannot read property 'qError' of undefined".

If I exclude "qCalcCond" and "qCalcCondition", the pivot table works fine, but it still displays the measure I don't want it to.


Am I just using qCalcCond wrong?

8 Replies
dselgo_eidex
Partner - Creator III
Partner - Creator III
Author

Does anyone have any insight into this?

ajaykakkar93
Specialist III
Specialist III

I am trying to find the same if i get a proper answer ill update.

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

jitu2110
Creator
Creator

does anyone found any solution on this, i am also looking for same issue.

ajaykakkar93
Specialist III
Specialist III

Hi,

ShowIf:{
    type: "string",
    label: "Show Column IF",
    ref: "qCalcCondition.qCond.qv",
    component: "expression"
}

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

dselgo_eidex
Partner - Creator III
Partner - Creator III
Author

Wow I posted this a while ago. Since then I have been able to disable pivot table measures. I'm not sure if it is something that I did or if it was fixed in a patch or something, but I haven't had any issues doing this since I posted this question.

It might be that I was passing the number 0 when you need to pass the string "0", but I honestly don't remember if I had tried that when I posted this.

Akansha
Contributor II
Contributor II

Hi,

Can you please tell me how to give an expression in qCalcCond? I want to use this property to stop calculation of my hypercube if all of the given filters are not selected. Is it possible to write something like below in qCalcCond?

Getselectedcount(filter1)>=1 AND Getselectedcount(filter2)>=1

Could you help me with the syntax

dselgo_eidex
Partner - Creator III
Partner - Creator III
Author

Try this:

"qCalcCond": {
    "qv": "=if(GetSelectedCount(filter1) >= 1 and GetSelectedCount(filter2) >= 1, 1, 0)"
},
"qCalcCondition": {
    "qCond": {
        "qv": ""
    },
    "qMsg": {
        "qv": ""
    }
}
Akansha
Contributor II
Contributor II

not working still, tried with quotes, without quotes

 
 
 
 
 
 

return {
initialProperties: {
qHyperCubeDef: {
qDimensions: [],
qMeasures: [],
qInitialDataFetch: [{
qWidth: 50,
qHeight: 100
}],
qCalcCond: {
qv: "=GetSelectedCount(Currency) >= 1"
},
qCalcCondition: {
qCond: {
qv: ""
},
qMsg: {
qv: ""
}
}

}
},
definition: props,
snapshot: {
canTakeSnapshot: true
},

paint: function ( $element, layout ) {

 

.......