Hello all, I have this script and am trying to calculate the % of an answer based on the question
data:
LOAD * INLINE [
Choose your Functional Group, How long?, The purpose is clear, How likely is it that you would recommend tool?
F1, 0-6 months, Agree, 1
F1, 6 months-1 year, Strongly Agree, 3
F2, 0-6 months, Disagree, 4
F2, More than 1 year, Strongly Disagree, 6
F3, 0-6 months, Aggee, 10
F3, 6 months-1 year, Neutral, 6
];
DataLoad:
CrossTable(Question, Answer)
LOAD [Choose your Functional Group] as Function,
[How long?],
[The purpose is clear],
[How likely is it that you would recommend tool?]
Resident data;
Duration:
LOAD * INLINE [
DurationSortOrder,AnswerDuration
1,More than 1 year
2,0-6 months
3,6 months-1 year
];
drop table data;
exit script;
from this, I tried several dimensions and expressions
Dimension to get a specific question
D1 =if(Match(AnswerDuration,Answer),Answer)
D2 - Function
However to calculate the duration percent for that question, I get the wrong answers
E1 - count(if(Match(AnswerDuration,Answer),Answer)) / count(total<Question,Answer>if(Match(AnswerDuration,Answer),Answer))
then I tried (Idea is to count total, filtering on both question and answer)
count(if(Match(AnswerDuration,Answer),Answer)) / count(total<if(Question={'How Long?'},Question),if(Match(AnswerDuration,Answer),Answer)>if(Match(AnswerDuration,Answer),Answer))
I can't seem to get the correct answers for this problem
TIA