Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have columns like Linkid,state,end1,end2.
Linkid contains numbers like 1...10.
state contains 0,1,2 ,1,0,1,1,0,2,1
end1 contains Yes,No like repetitively upto 10 rows
end2 also contains Yes,No upto 10 rows.
Now my requirement is i need to divide state into 4 stages based on state,end1,end2.
Stage0 =total count of linkid.
Stage1=selection of state(0,1)
Stage2=selection of state(0,1) and end1(Yes)
Stage3=selection of state(0,1) and end1(Yes) and end2(Yes)
The above i have created in script like
if(state=0 and state=1,'Stag1',
if(state=0 and state=1 and end1='Yes','Stag2',
if(state=0 and state=1 and end1='Yes' and end2='Yes','Stag3'))) as Newstate,(I haven't included Stage0 could you please check)
After reloading i haven't got any data for newstate showing empty.May be i have done wrong in script part of if condition.
Please check attachment of excel data and qlikview file below.
Could you please help me on that with including Stage0?
Thanks,
Kanna
Dear Rajesh,
I have checked your if else condition,
I think you need to use OR Operator instead of AND Operator between state =0 and state =1
This is not possible to use AND Operator on the same field such as you have done, state field either be 0 or 1.
How the same field can be 0 and 1 at the same time?
Kindly find attached file.
Kind regards,
Ishfaque Ahmed
If I am including both we need to put AND only na..OR we use of either this
or another.
Dear Rajesh,
Here is the AND Operator output,
state | state1 | output |
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
Here is the OR Operator output,
state | state1 | output |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
Then how can be possible that you are saying state = 0 and state = 1 ?
You can apply AND Operator in that way state = 0 AND state1 = 1.
Kind regards,
Ishfaque Ahmed
Thanks for your response.
Here 1 and 0 are not Boolean values ..I can also take 1 and 2 also any
numbers that time not possible.
Dear Rajesh,
Here is your excel file data,
linkid | state | end1 | end2 |
1 | 0 | Yes | Yes |
2 | 1 | Yes | No |
3 | 1 | No | No |
5 | 2 | Yes | Yes |
6 | 1 | No | No |
4 | 2 | No | Yes |
3 | 0 | Yes | Yes |
4 | 1 | Yes | No |
6 | 0 | No | Yes |
4 | 0 | Yes | Yes |
3 | 2 | No | Yes |
state is a field where you are applying AND Operator. So I'm telling you this is not possible at the same time state contain 0 and 1. state either be 0 or 1 at a time.
Solution: create one more state1 field where you put your 1 or 2 values and then perform AND operation in IF else condition. Such as I illustrated in previous post.
Kind regards,
Ishfaque Ahmed
Can you please help me on writing sample data to load including state2 and
also script part with stages I have asked in requirement, that should be
very helpful for me.
Thanks,
Rajesh
Dear Rajesh,
Sure, please share me your desired output.
Kind regards,
Ishfaque Ahmed
try like this...
IF((State=0 or State=1) and end1='Yes' and end2='Yes','Stage3',
IF((State=0 or State=1) and end1='Yes' ,'stage2',
IF((State=0 or State=1),'stage1'))) as NewState
Dear Rajesh,
Kindly find attached App, I hope you are looking for that one solution.
Kind regards,
Ishfaque Ahmed