Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

Comparing two states row by row

Hi guys,

I am trying to create a KPI which tells me the number of customers that purchased in one selection also purchased in the other. 

Not sure how to do this, anyone know?

This is my code in app:

SUM(If([Transaction Member ID]={Alt}[Transaction Member ID],1,0))

I may be doing this very wrong, any help is appreciated.

Thanks in advance.

Tags (1)
1 Solution

Accepted Solutions
Not applicable

Re: Comparing two states row by row

Ok, I think this will require changing the data structure. Thought there was an easier way :l.

Thanks for your help though

11 Replies

Re: Comparing two states row by row

May be this

Count(DISTINCT {<[Transaction Member ID] = p({<[Transaction Member ID] = [Alt]::[Transaction Member ID]>})>} Customer)

Not applicable

Re: Comparing two states row by row

Hi Sunny,

Sorry for late reply, was on holiday.

Thanks for your reply, unfortunately the code doesn't seem to work. I only get count of the main state selection -  do you know what could be causing this?

Re: Comparing two states row by row

How about this

Count(DISTINCT {<[Transaction Member ID] = [Alt]::[Transaction Member ID]>} Customer)

Not applicable

Re: Comparing two states row by row

Same answer , I'm not sure if the [Alt]:: part of the code is working

Re: Comparing two states row by row

What is Alt here? The name of your alternate state?

Not applicable

Re: Comparing two states row by row

Yeah Sunny, that's the name of the alternate state

Re: Comparing two states row by row

Are you using some kind of extension to do this? Might be the reason why the expression doesn't work.

Not applicable

Re: Comparing two states row by row

Yeah, I am using an extension for it - is there another way of doing comparative analysis?

Re: Comparing two states row by row

See if this thread can help (specifically Richard's response)

Re: alternate states in qlik sense

Community Browser