Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On Demand Webinar: See Why Thousands of QlikView Users Have Switched to Qlik Sense. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
male_carrasco
Creator
Creator

P() Variables

Hola,

Estoy calculando el % de clientes que compraron por ejemplo el producto A y B.

Ejemplo:

Count({1<Cliente = P({<Producto = {'A'} >})*P({<Producto = {'B'} >})>}Distinct Cliente)/ Count({1}DISTINCT Cliente)

Necesito que sea una formula dinámica que calcule el % según los productos seleccionados.

Desde ya muchas gracias por la ayuda.

Adjunto ejemplo

Slds,

Ale.

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Try using the formula:

=num(Count({1<Cliente = $(=concat(distinct 'P({<Producto = {' & Producto & '} >})', '*'))>}Distinct Cliente)/ Count({1}DISTINCT Cliente),'#.###,%')

Hope this helps!

View solution in original post

5 Replies
jsaradhi
Specialist
Specialist

you are missing field names in your p() function. try this:

Count({1<Cliente = P({<Producto = {'A'} >}Cliente)*P({<Producto = {'B'}>Cliente)})>}Distinct Cliente)

you could combine them too I would think, something like

Count({1<Cliente = P({<Producto += {'A','B'} >}Cliente)})>}Distinct Cliente)

for the percentage you could use num function...wrap the entire expression in num(), for example,

num(/*your expression*/,'##.#%')

male_carrasco
Creator
Creator

Thanks jsaradhi<http://community.qlik.com/people/jsaradhi>

I need to be a dynamic formula that calculates the% according to selection.

Please see attached.

Ale.-

jsaradhi
Specialist
Specialist

sorry...i misunderstood your requirement. let me look into it.

jerem1234
Specialist II
Specialist II

Try using the formula:

=num(Count({1<Cliente = $(=concat(distinct 'P({<Producto = {' & Producto & '} >})', '*'))>}Distinct Cliente)/ Count({1}DISTINCT Cliente),'#.###,%')

Hope this helps!

View solution in original post

male_carrasco
Creator
Creator

Thanks jerem1234