Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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.

1 Solution

Accepted Solutions
Not applicable
Author

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

Thanks for your help though

View solution in original post

11 Replies
sunny_talwar

May be this

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

Not applicable
Author

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?

sunny_talwar

How about this

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

Not applicable
Author

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

sunny_talwar

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

Not applicable
Author

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

sunny_talwar

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

Not applicable
Author

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

sunny_talwar

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

Re: alternate states in qlik sense