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

pivot table not displaying results

Hello there,

 

I am new to Qlikview  and I need your assistance to get the results of my survey answers displayed in a pivot table

I have 2 tables loaded from a database for survey questions and answers.

One with the survey question text , the survey that the question belong to and the question ID

question_textsurvey_idquestion_id
Do you find the steps in the documents simple and straightforward?50efkjgbjsrrhjtrwj98735jksdfeharqonrtwe4377

 

the second table contains the answers and the question id corresponding to that answer, the unique answers id, the answer dates, the survey id that the question and answer belong to, the user email and the unique user id who responded to that survey

 

answer_idanswer_dateanswer_textreplied_question_idsurvey_iduser_detailsuser_survey_id
eoifjeclkmwe56739822018-03-19T10:59:27.204ZYes5jksdfeharqonrtwe437750efkjgbjsrrhjtrwj9873xyz@mail.com9474d9d0-2b64-11e8-afa2-614a88624bdb-1521457162221
eriofmkelegy3473200e2018-03-19T10:59:34.597ZThanks, it was great5jksdfe45rqonrtwe437050efkjgbjsrrhjtrwj9873abc@mail.com9c6a0d40-2b64-11e8-82e4-d1195c5377f8-1521457175572
9574857ltymtyshe88832018-03-19T10:59:38.404ZNot really5jksdfeharqo382we437950efkjgbjsrrhjtrwj9873abc@mail.com9c6a0d40-2b64-11e8-82e4-d1195c5377f8-1521457175572
sacdapyui689343kkjdf62018-03-19T10:59:38.705Z4 stars5jksdfeharqonrtwe439050efkjgbjsrrhjtrwj9873anonymous

9d9e4780-2b64-11e8-9d76-3db6a4092cf1-152145717759

 

What I need to do is display in a pivot table the user mail, the questions he replied to (translate the replied_question_id to question_text) and his answers

I tried this: if(replied_question_id=question_id, question_text,) but it didn't display anything.

 

Can you please assist how can I achieve that result?

14 Replies
shreya_nadkarni
Partner - Creator
Partner - Creator

Can you post the required output.

Thanks

santhiqlik
Creator
Creator

Hi,
Left join survey table with answers table so that you can get question text in Anwer table. Then you need not load Survey table separately.
Let me know if you have any questions on this.

--Priya
Anonymous
Not applicable
Author

@santhiqlik Thank you Priya, but it is still not working, actually it gives a blank cell.

 

Any other suggestion?

Anonymous
Not applicable
Author

hello @shreya_nadkarni

 

Sure, I need it to look like that at the end 

 

Capture1.PNG

 

santhiqlik
Creator
Creator

Hi Samar,

Have you renamed replied_question_id as question_id while left joining as below. If not please try that
surveytab:
Load
*
from answertable //name & Path of your Answer table
Left Join
Load
survey_id,
replied_question_id as question_id,
question_text
from surveytable; //name & Path of survey table

Otherwise try loading it using Mapping Load as below

Map_QuestionID:

Mapping Load
survey_id & '_' & "question_id" as SurveyQues , //composite key to get question text
question_text
From SurveyTable;

Load
*,
ApplyMap('Map_QuestionID',survey_id & '_' & replied_question_id ,Null()) as question_text
From AnswerTable
Anonymous
Not applicable
Author

Hello @santhiqlik actually the question text disappeared.

Capture3.PNG

I'm loading from a database using SQL statements, did I insert any incorrect iput in the script below? 

 

Map_QuestionID:

Mapping Load
survey_id & '_' & "question_id" as SurveyQues , //composite key to get question text
question_text;
SQL SELECT`question_id`,`question_text`, `survey_id`, ......... From SurveyTable;
Load `_id` as answer_id
ApplyMap('Map_QuestionID',survey_id & '_' & replied_question_id ,Null()) as question_text
SQL SELECT  `_id`, `answer_date`, `answer_text`,, .........From AnswerTable;

 

santhiqlik
Creator
Creator

Hi Samar,

Please check below solution for your problem

Tab_Survey:
SQL SELECT`question_id`,`question_text`, `survey_id`, ......... From SurveyTable;

Map_QuestionID:
Mapping Load
    survey_id & '_' & question_id as SurveyQues ,    //Removed " in question_id. it was added by mistake.  
     question_text
Resident Tab_Survey;

Drop table Tab_Survey;


Tab_Answer:

Load

 `_id` as answer_id, //add all the required columns as we are not using * here 
ApplyMap('Map_QuestionID',survey_id & '_' & replied_question_id ,Null()) as question_text;
SQL SELECT `_id`, `answer_date`, `answer_text`,, .........From AnswerTable;

Anonymous
Not applicable
Author

Hello @santhiqlik 

still the same results I tried to display the question_text in a list box, it's not showing any results.

santhiqlik
Creator
Creator

Please share the qvf or sample data in Excel if possible