Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to achieve the following. Can someone explain how do i load the following with the result table shown below:
Dataset1: | |||
PN | Day1 | Day2: | Day3: |
1234 | 3 | 4 | 5 |
2345 | 10 | 12 | 10 |
3456 | 9 | 8 | 7 |
5678 | 6 | 8 | 8 |
9876 | 5 | 6 | 8 |
Dataset2: | |||
PN | Day1 | Day2: | Day3: |
9981 | 3 | 4 | 5 |
6671 | 10 | 12 | 10 |
5674 | 9 | 8 | 7 |
1234 | 10 | 10 | 10 |
2345 | 20 | 20 | 20 |
Result: | |||
PN | Day1 | Day2: | Day3: |
1234 | 13 | 14 | 15 |
2345 | 30 | 32 | 30 |
3456 | 9 | 8 | 7 |
5678 | 6 | 8 | 8 |
9876 | 5 | 6 | 8 |
9981 | 3 | 4 | 5 |
6671 | 10 | 12 | 10 |
5674 | 9 | 8 | 7 |
I tried to use the concatenate/Join, but it does give me the parts repeated twice in both tables.
Can someone help?
Thanks,
Vidya
Try
Dataset1:
LOAD * INLINE [
PN, Day1, Day2, Day3
1234, 3, 4, 5
2345, 10, 12, 10
3456, 9, 8, 7
5678, 6, 8, 8
9876, 5, 6, 8
];
Concatenate
Dataset2:
LOAD * INLINE [
PN, Day1, Day2, Day3
9981, 3, 4, 5
6671, 10, 12, 10
5674, 9, 8, 7
1234, 10, 10, 10
2345, 20, 20, 20
];
Result:
NoConcatenate
LOAD
PN,
SUM(Day1) as Day1,
SUM(Day2) as Day2,
SUM(Day3) as Day3
Resident Dataset1
Group by PN;
DROP Table Dataset1;
Try
Dataset1:
LOAD * INLINE [
PN, Day1, Day2, Day3
1234, 3, 4, 5
2345, 10, 12, 10
3456, 9, 8, 7
5678, 6, 8, 8
9876, 5, 6, 8
];
Concatenate
Dataset2:
LOAD * INLINE [
PN, Day1, Day2, Day3
9981, 3, 4, 5
6671, 10, 12, 10
5674, 9, 8, 7
1234, 10, 10, 10
2345, 20, 20, 20
];
Result:
NoConcatenate
LOAD
PN,
SUM(Day1) as Day1,
SUM(Day2) as Day2,
SUM(Day3) as Day3
Resident Dataset1
Group by PN;
DROP Table Dataset1;
Hi,
Do you want to do it in the script or on the UI ?
I think it is better to do it in the UI, you just have to create a table in the graphs, then put PN and Days as dimension, the expression should be
sum(Day1)+sum(Day2)+sum(Day3)
I want to do it in loading script.
Try this:
Dataset1:
LOAD * INLINE [
PN, Day1, Day2, Day3
1234, 3, 4, 5
2345, 10, 12, 10
3456, 9, 8, 7
5678, 6, 8, 8
9876, 5, 6, 8
];
Dataset2:
LOAD * INLINE [
PN, Day1, Day2, Day3
9981, 3, 4, 5
6671, 10, 12, 10
5674, 9, 8, 7
1234, 10, 10, 10
2345, 20, 20, 20
];
NoConcatenate
Final:
LOAD PN,
Sum(Day1) AS Day1,
Sum(Day2) AS Day2,
Sum(Day3) AS Day3
Resident Dataset1
Group By PN;
Drop Table Dataset1;
Then when 2 tables have the same fields, QlikView automatically concatenate the 2 tables.
So you just have to create a new table in which you use sum(DAYS_FIELD) with a group by PN (dont forget to use NO CONCATENATE) otherwise this new table will be added concatenate to the old one also.
Thanks Vamsee. It worked
Thanks Vishwa. It worked.