Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression %


I wonder if you can help me I have a Chart that I'm currently running this expression on:

=count ({<[OC] = {'C'}>} Distinct Order)

this is counting the orders that only have the OC field set to C

what I'm trying to achieve is  this but then divide it by total orders to work out the % of orders going via this method if that makes sense

so for instance when I select a customers name it shows me 30% of there orders when via Method C

in SQL you would do a simple Count Orders / Orders where OC = C


3 Replies
MVP & Luminary
MVP & Luminary

Re: Expression %

I'm not sure if I understand your question right but try this:

=count ({<[OC] = {'C'}>} Distinct Order) / count ({<[OC] = {'C'}>} Distinct TOTAL Order)

- Marcus

Creator III
Creator III

Re: Expression %


WHat are you exactly triying to do?

If you need to check the % of OC=C orders compare to total orders, try this:

=count ({<[OC] = {'C'}>} Distinct Order)/count (Distinct Order)*100

If you need to check the % of OC=C orders of a given client compare to total OC=C orders, try this:

=count ({<[OC] = {'C'}>} Distinct Order)/count ({<[OC] = {'C'}>}TOTAL Distinct Order)*100


Re: Expression %

Try this

     count ({<[OC] = {'C'}>} Distinct Order) / count (Distinct TOTAL Order)