Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have and expression like this:
IF(GetSelectedCount(SequenceInd)=0,
Count({$<RecOpenStatus = {'Open'}, SequenceInd = {'Seq'}>}DISTINCT ReceivableID),
Count({$<RecOpenStatus = {'Open'}>}DISTINCT ReceivableID))
I don't think what I want to do is possible but I am hoping I am wrong and that I can increase performance. Is there another way to have my expression as Count({$<RecOpenStatus = {'Open'}, SequenceInd = {'Seq'}>}DISTINCT ReceivableID) but if another SequenceInd is selected, the result will reflect that? I am looking to reduce the IF statements in my application.
Can you try this -
Count({$<SequenceInd = {$(=GetSelectedCount(SequenceInd)=0)},RecOpenStatus = {'Open'}, SequenceInd = {'Seq'}>}DISTINCT ReceivableID),Count({$<RecOpenStatus = {'Open'}>}DISTINCT ReceivableID))
This returned null, althought I had to only use the part before the comma since using the entire thing is an invalid dimension.
For the first half, did you mean to put GetCurrentSelection instead of GetSelectedCount? I can almost see how that will work but I need it to default to 'Seq' still if possible.
You could use a variable to control the possible value of SequenceInd in your set analysis.
You would want to first create a variable; something like this:
vSeq_Selected = IF(GetFieldSelections(SequenceInd) <> 'Seq', GetFieldSelections(SequenceInd), 'Seq)
Then in your set analysis you would replace
SequenceInd = {'Seq'} With SequenceInd = {'$(vSeq_Selected)'}
Now If SequenceInd is not selected it will default to calculate it being Seq; if it is selected, it should calculate for the selected value.
Neelam, I think you are missing double quotes:
Count({$<SequenceInd = {$("=GetSelectedCount(SequenceInd)=0")},RecOpenStatus = {'Open'}, SequenceInd = {'Seq'}>}DISTINCT ReceivableID),Count({$<RecOpenStatus = {'Open'}>}DISTINCT ReceivableID))
Thanks Thirumala for pointing that out. Appreciate it. Sometimes these little things gets missed out when you are directly writing expression without the actual qv file
.
I was thinking maybe something like this, but do you know if this would improve performance at all since there is still an IF statement? I had read that IF statements can hinder performance, which seems to be the case for me so I was looking for ways to eliminate them if possible.
This still doesn't work. I don't think qlik will take two separate measures just separated by a comma or at least it doesnt work for me.
Unfortunately, I couldn't tell you without testing. If the IF Statement you reference is an Object Expression, then I could see this solution potentially saving time because of when it's calculated. If that IF Statement is a variable just the same as the solution I propose; it may not be.
I was really hoping this would work so I was testing performance next to another object that had the IF statement, and if I changed the selection the object with the IF statement calculated about 2 seconds quicker than the one using the variable within the set analysis.