Qlik Community

Qlik Sense App Development

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

Highlighted
Partner
Partner

Measuring Two dimensions with same values

Hi my friends

I have a table witch include two dimensions with same values (Not specifically on the same rows ).

I need to count rows for every distinct value on this dimensions, Like the example below.

Any ideas?

Thanks, Sela 

Symmetric difference.png

 

5 Replies
miskinmaz
Contributor II

Re: Measuring Two dimensions with same values

Hi,

You can try below code.

Load
Lead_id,
source A as source,
"A" as flag
from table

concatenate
Load
Lead_id,
source B as source,
"B" as flag
from table

and in expression you can try
count({<flag="A">}lead_id)
Partner
Partner

Re: Measuring Two dimensions with same values

Is there any solution with on-the-fly calculation?

I already tried 'Value list'  and Set Analysis, But it didn't worked....

Re: Measuring Two dimensions with same values

May be an expression like this

If(ValueList('Web', 'Phone', 'Email') = 'Web',
	Count(DISTINCT {<[Source A] = {'Web'}>} Lead_ID),
If(ValueList('Web', 'Phone', 'Email') = 'Phone',
	Count(DISTINCT {<[Source A] = {'Phone'}>} Lead_ID),
If(ValueList('Web', 'Phone', 'Email') = 'Email',
	Count(DISTINCT {<[Source A] = {'Email'}>} Lead_ID))))

and

If(ValueList('Web', 'Phone', 'Email') = 'Web',
	Count(DISTINCT {<[Source B] = {'Web'}>} Lead_ID),
If(ValueList('Web', 'Phone', 'Email') = 'Phone',
	Count(DISTINCT {<[Source B] = {'Phone'}>} Lead_ID),
If(ValueList('Web', 'Phone', 'Email') = 'Email',
	Count(DISTINCT {<[Source B] = {'Email'}>} Lead_ID))))

With this dimension

=ValueList('Web', 'Phone', 'Email')
Partner
Partner

Re: Measuring Two dimensions with same values

Thank you for your ans 🙂

I have a long and dynamic list.

Because of that, I need some way to do it without "Ifs".

Is there any way to make it sort and dynamic?

 

 

 

 

Re: Measuring Two dimensions with same values

Nope, only way is to transform your data using CrossTable load in the script. Can't think of another easy way to do this