Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

count will not work with button

Dear all,

after having tried all Aggr variations I am still stuck with simple triggered count.

Assume - a button (MaxFilter) selects the wanted focus on a Combo chart - meaning calculating Sums of Amounts either with Maximum per Dimensions or without and showing related Numbers as well:

if(MaxFilter=0,

Sum(  {<Version={'V1'},doctype={$(Inputbox_doctype)}, per={$(Inputbox_period)} >} Value),

Sum(  {<Version={'V2'},doctype={$(Inputbox_doctype)}, per={$(Inputbox_period)} >} Value) -

Max(  {<Version={'V2'},doctype={$(Inputbox_doctype)}, per={$(Inputbox_period)} >} Value)

)

>>This works fine

if(MaxFilter=0,

Count(  {<Version={'V1'},doctype={$(Inputbox_doctype)}, per={$(Inputbox_period)} >} ID),

Count(  {<Version={'V2'},doctype={$(Inputbox_doctype)}, per={$(Inputbox_period)} >} ID) -1

)

>>This does not work for MaxFilter=1  but would if I do remove the "-1".  Why can't I reduce QlikViews Count result for the one Max-ID?


Thanks for your help!

Tobias

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

ok, probably this is just another inappropriate non-Use of Aggr - but I still can´t see how it should work correctly.

>the time dimension is filled day by day

> so in the fact table there are Null Values and therefore my Formula is obviously producing "Null"

> but only in the 2. Part of the IF clause where the Formula is expanded by "-1"  as if QV cant't count and substract at a time

Replacing the "-1" with

"- Max({<Version={'V1'},doctype={$(Inputbox_doctype)}, per={$(Inputbox_period)} >} Value)/

    Max({<Version={'V1'},doctype={$(Inputbox_doctype)}, per={$(Inputbox_period)} >} Value)"


(which equals to  -1) is doing the trick! Now it works.

count-1.PNG

Thanks for your thoughts!

Tobias

View solution in original post

5 Replies
sunny_talwar
MVP
MVP

Try this:

If(MaxFilter=0,

Count({<Version={'V1'},doctype={$(Inputbox_doctype)}, per={$(Inputbox_period)} >} ID),

(Count({<Version={'V2'},doctype={$(Inputbox_doctype)}, per={$(Inputbox_period)} >} ID) -1)

)

Not applicable
Author

Thanks Sunny!

I tried already without any luck. Result is: "-1".

Tobias

sunny_talwar
MVP
MVP

Would you be able to share a sample to show what exactly is going on?

Not applicable
Author

ok, probably this is just another inappropriate non-Use of Aggr - but I still can´t see how it should work correctly.

>the time dimension is filled day by day

> so in the fact table there are Null Values and therefore my Formula is obviously producing "Null"

> but only in the 2. Part of the IF clause where the Formula is expanded by "-1"  as if QV cant't count and substract at a time

Replacing the "-1" with

"- Max({<Version={'V1'},doctype={$(Inputbox_doctype)}, per={$(Inputbox_period)} >} Value)/

    Max({<Version={'V1'},doctype={$(Inputbox_doctype)}, per={$(Inputbox_period)} >} Value)"


(which equals to  -1) is doing the trick! Now it works.

count-1.PNG

Thanks for your thoughts!

Tobias

sunny_talwar
MVP
MVP

If you were able to achieve what you wanted, please close this thread by marking your response as correct.

Best,

Sunny