Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

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

Contributor 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)

Community Browser