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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

count & max

hi,

i have feild in the line order with value 1 or 2.

i want to calculte in%

exm:

order num 1 - i have 5 lines with 1 & 1 line with 2

order num 2 - i have 5 lines with 1 & 0 line with 2

order num 3 - i have 0 lines with 1 & 4 line with 2


i want to know in % how many orders have only 2 in that feild - in the exm 33%

how do i write it?

thanks'

yarin.

15 Replies
effinty2112
Master
Master

Dear Solomon,

                         That's a rather bold statement "This Problem can only be solved by the load statements as follows.."

The original post said that [test field] held only two values so we needn't consider other values, but if we do the expression below works, including for your extra records with [test field]  = 3:

=count({$<order= E({<[test field] = {$(=Concat(DISTINCT if(Not Match([test field],2),[test field]),','))}>})>}DISTINCT order)

Kind regards

Andrew

soloeeeoff
Contributor III
Contributor III

Thanks my beloved brother Andrew.

soloeeeoff
Contributor III
Contributor III

Hi Yarin,

I really wanna thank You for asking this question.

Today I found a solution.

1. Use Text Box

2. type as

=count({1} Aggr(Only({1} [test field]), order))

This solves the problem

Thanks,

soloeeeoff
Contributor III
Contributor III

Hi Andrew,

The following statement solves the problem ( Use Text Box)

=count({1} Aggr(Only({1} [test field]), order))

soloeeeoff
Contributor III
Contributor III

If it exactly for the Test order =2

then use

=count({1<[test field]={'2'}>} Aggr(Only([test field]), order))



Thanks

effinty2112
Master
Master

Hi Solomon,

                    I like your idea of aggregating Only(). It's a neat solution.

Kind regards

Andrew