Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a question, how can I create a flag or create an if statement based on the result from the first if statements.
Like if(statement 1=true,
then *and only then check* if (statement 2=true, 1) as Flag
Thank You
I didn't understand, I assume this?
If(Statement1 = 'True' and Statement2 = 'True', 1, 0) as Flag
In future if you want to show only True Sales then you can use Flag like below
Sum({<Flag = {'1'}>}Sales)
May be this:
If(Statement1 = 'True',
If(Statement2 = 'True', 1)) as Flag
or use Anil's approach....
Thanks for the replies, but here is my scenario.
I would like to create a flag from a list of possible fields from a previous flag.
i.e. I created a flag for all students that passed their final test, now out of that flag of students, I want to get a count of all students that answered a particular question with a certain response.
I tried the above option nested if statement but my answer is null. So it is like selecting all possible from a previous if statement. I hope this makes sense. Unfortunately, I do not have a .qvw to share on this. And I would like to create this final flag in the script if possible.
Thank you for your help.
Can you share the script at least?
Thanks, for example, so basically out of all of the student that scored>75, check to see if they got a particular response on number 23, then flag them.
Load
*,
if(Pass_Flg=1 and Question=23 and Response='Answer',1) as ExceptionStudent_Flg
Load
Student,
Grade,
if(Grade>75,1) as Pass_Flg
Question,
Response
from table;
Thank you
This looks right to me, is this not giving you the result you are looking for?
no, I don t get any values
Seems to be working for me
Table:
LOAD *,
If(Pass_Flg = 1 and Question = 23 and Response = 'Answer', 1) as ExceptionStudent_Flg;
LOAD *,
If(Grade > 75, 1) as Pass_Flg;
LOAD * INLINE [
Student, Grade, Question, Response
A, 80, 23, Answer
A, 72, 24, No
A, 95, 25, Answer
B, 65, 23, Answer
B, 82, 24, Answer
B, 92, 25, No
C, 82, 23, No
C, 65, 24, No
C, 40, 25, No
D, 98, 23, Answer
D, 95, 24, Answer
D, 93, 25, Answer
];
What's the difference between my example and your actual scenario?
Thanks I will check my data.