
Re: Compute proportion between two tables
Mohammed Mukram Sep 10, 2017 7:50 AM (in response to Eleyeh Abaneh)Dear Eleyeh,
Can you attached sample data file .
Thanks,
Mukram

Re: Compute proportion between two tables
Eleyeh Abaneh Sep 10, 2017 8:07 AM (in response to Mohammed Mukram)Hi Mukram,
Here's a data sample :
Sales A Sales B 1
1 4 2 5 3 9 4 15
15 11 11 3 4 12 18 0 4 1 1 8 7 So in this example each table has 11 lines and 4 lines have equal values in both columns. So the desired output should be 4/11

Re: Compute proportion between two tables
Mohammed Mukram Sep 10, 2017 9:18 AM (in response to Eleyeh Abaneh)Dear Eleyeh,
As you mentioned in your first comment you have two tables
How those Two Tables are Connected with each other ? (Based on Date ).
IF based on Date field then we can create a flag in the backend to check on each date SAELS A and SALES B if
both are Equal then flag value 1 else 0 and we can use that flag in the front end.
if you can share your sample data with the same structure it will good for us to help you in better way.
Thanks,
Mukram.



Re: Compute proportion between two tables
Vineeth Pujari Sep 10, 2017 9:18 AM (in response to Eleyeh Abaneh)Try as below
TableA:
LOAD [Sales A] , Rowno() as RowKEY
FROM
[https://community.qlik.com/thread/274005]
(html, codepage is 1252, embedded labels, table is @1);
TableB:
LOAD
[Sales B] , Rowno() as RowKEY
FROM
[https://community.qlik.com/thread/274005]
(html, codepage is 1252, embedded labels, table is @1);
now create a straight table with dimensions
RowKEY, Sales A , Sales B
add below expression
sum(if([Sales A]=[Sales B],1))
or in a textbox
=sum(if([Sales A]=[Sales B],1)) & ' / ' & count(DISTINCT RowKEY) /// string 4 / 11
or
=sum(if([Sales A]=[Sales B],1)) / count(DISTINCT RowKEY) // Percentage 4 / 11
can you provide something that closely matches the dataset you are working with?

Re: Compute proportion between two tables
Eleyeh Abaneh Sep 10, 2017 12:52 PM (in response to Eleyeh Abaneh)Thanks Vineeth and Mukram for you answers !
I am sorry but I unfortunately can't give a sample of the data I work with. However I can give more details about my dataset. So Sales A and Sales B are two tables that are loaded separately from the database. Each tables has two columns : one with the quantity of sales per day and another column with the date the sales are made. So the tables are connected by the date. The rest of it really similar to the example I've given.
Thanks again for you answers, I will try them tomorrow !

Re: Compute proportion between two tables
Vineeth Pujari Sep 11, 2017 4:11 PM (in response to Eleyeh Abaneh)We don't need a real sample of your data!
But you can create dummy data that represents your dataset.
