Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How can I "see" the equivalent to P() in a dimension - with an if statement?

The P() and E() functions seem great except you have to use them in an aggregation (or measure). But I'm doing a lot of complex junk, so it'd be nice to see exactly WHAT is being summed/counted/etc. So if I can see it as a dimension, that'd be swell.

For the example in the help section:

sum({<Customer=P({<Product1={'Shoe'}>}Customer)>}Sales)

I thought about the equivalent formula as

=sum(if(Customer = if(Product1='Shoe',Customer),Sales))

So to see what's going on, I can do a filter pane with just

if(customer=(if(product='shoes'),customer),sales)

Alas, my version of this isn't working.

What's the equivalent of the P() in dimension-land? Is it possible? And if not possible, why?

Thanks, y'all!

5 Replies
isingh30
Specialist
Specialist

What exactly are you doing? Please state your requirement with data or app?

sunny_talwar

May be this

=Sum(Aggr(If(SubStringCount(Concat(TOTAL <Customer> '|' &Product & '|'), '|Shoe|'), Sales), Customer, Product))


Capture.PNG

Anonymous
Not applicable
Author

Here's the data set and a bit of the work I've been doing. Thanks so much for taking a peek.

sunny_talwar

Here you go

Sum(Aggr(If(SubStringCount(Concat(DISTINCT '|' &Product1 & '|'), '|Shoe|') = 1, Sum(Sales)), Customer))

krishna_2644
Specialist III
Specialist III

Hi,

sum({<Customer=P({<Product1={'Shoe'}>}Customer)>}Sales)   EQUIVALENT TO


Sum of Sales of Possible Customers when Product1='Shoe'.



if(customer=(if(product='shoes'),customer),sales)   EQUIVALENT TO


you are saying Qlikview that only when Product1='shoes',then calculate Sum(Sales) of customers when product1='Shoes'



and hence both expressions are completely different and return different values (unless it is accidental or co-incidence)


Hope that makes Sense.