Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Period | Customer | Rep |
---|---|---|
201301 | C1 | Rep1 |
201301 | C2 | Rep1 |
201301 | C2 | Rep2 |
201301 | C3 | Rep2 |
201302 | C1 | Rep1 |
201302 | C2 | Rep2 |
201302 | C3 | Rep2 |
Period | Customer | Feedback |
---|---|---|
201301 | C1 | good |
201301 | C2 | better |
201301 | C3 | best |
201302 | C1 | better |
201302 | C2 | better |
201302 | C3 | best |
I want to get table 3 in load script as following, but how to write the script?
Period | Customer | Feedback | Overlap_flag |
---|---|---|---|
201301 | C1 | good | 0 |
201301 | C2 | better | 1 |
201301 | C3 | best | 0 |
201302 | C1 | better | 0 |
201302 | C2 | better | 0 |
201302 | C3 | best | 0 |
Hi,
Find the attached file
try this
in script--
table1:
load if(Previous(Customer)<>Customer,0,1) as Overlap_flag,* Inline [
Period, Customer, Rep
201301, C1, Rep1
201301, C2, Rep1
201301, C2, Rep2
201301, C3, Rep2
201302, C1, Rep1
201302, C2, Rep2
201302, C3, Rep2
];
join
table2:
load * Inline [
Period, Customer, Feedback
201301, C1, good
201301, C2, better
201301, C3, best
201302, C1, better
201302, C2, better
201302, C3, best
];
table3:
load
Period,
Customer,
only(Feedback) as Feedback
Resident table1
Group by Period,Customer;
then take pivote chart--
Dimension1--- Period
dimension2--- Customer
expression1-- Feedback
expression2-- Aggr(max(Overlap_flag),Customer,Period) //Overlap_flag or simly use max(Overlap_flag)
then output like this
Period | Customer | Feedback | Overlap_flag |
201301 | C1 | good | 0 |
201301 | C2 | better | 1 |
201301 | C3 | best | 0 |
201302 | C1 | better | 0 |
201302 | C2 | better | 0 |
201302 | C3 | best | 0 |
hi
if your problem resolved then marked it as either correct or helpful according to your question so that it might be helpful for other developer
Regards
vishwaranjan