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

Count matching characters

Hi all ,

Sunny Talwar

Petter Skjolden

I need to count the matching characters in a field value

example:  one exam  100 questions are there   I have written 100 answers   like

ABCACDAABC............  like 100

for this  key also avaialbe in second table   like

ABBBBCCCCC      so  my answer and key  to match and check how many correct or wrong by letter by letter

in this   ABCACDAABC --my answers   

             | | \ \ | | | \ \ \ \                 in this example  - 3 is correct answer count  7 is wrong count

           ABBBBCCCCC      -- key       so First letter A-A   1st answer correct so count 1   [so how many correct answers that count and wrong count]

B-B correct  so like that correct answer count and wrong answer count

11 Replies
MarcoWedel

Hi,

if you also want to extend the granularity of your analysis to include the different questions itself, then maybe one solution can be:

QlikCommunity_Thread_298246_Pic1.JPG

QlikCommunity_Thread_298246_Pic2.JPG

QlikCommunity_Thread_298246_Pic3.JPG

QlikCommunity_Thread_298246_Pic4.JPG

QlikCommunity_Thread_298246_Pic5.JPG

QlikCommunity_Thread_298246_Pic6.JPG

tabTests:

LOAD *

FROM [https://community.qlik.com/servlet/JiveServlet/download/1471086-322045/Match.xlsx] (ooxml, embedded labels, table is Sheet1, filters(Remove(Row, Pos(Top, 10)),Remove(Row, Pos(Top, 9)),Remove(Row, Pos(Top, 8))));

tabResults:

LOAD *

FROM [https://community.qlik.com/servlet/JiveServlet/download/1471086-322045/Match.xlsx] (ooxml, embedded labels, table is Tabl1);

tabAnswersTemp:

LOAD [Test Number],

    Key

Resident tabTests;

Inner Join

LOAD [Test Number],

    SSN,

    [Answer Sheet/ Scores]

Resident tabResults;

tabAnswers:

LOAD *,

    If(Answer=CorrectAnswer,Dual('Yes',1),Dual('No',0)) as IsCorrect;

LOAD SSN,

    IterNo() as Question,

    Mid(Key,IterNo(),1) as CorrectAnswer,

    Mid([Answer Sheet/ Scores],IterNo(),1) as Answer

Resident tabAnswersTemp

While IterNo()<=Len(Key);

DROP Table tabAnswersTemp;

hope this helps

regards

Marco

soniasweety
Master
Master
Author

Hi

in my original data it is showing  duplicates how can I insert distinct in the expression?

example  correct :40 means its showing 80