Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

who are the duplicate customers who had quarterly index difference of 4 and less

I am using qlikview personal edition and like to seek help for the question below. can someone assist me on the scripts?

I have a excel table (subset of this data is shown below) which I will be loading in to qlikview.

 

Customer Quarterly Index
A1
B1
C 1
D1
A4
B5
C 5
D3
A9
B8
C 9
D10

I would like to know:

1. Who are the same/duplicate customer with quarterly index of 3 and lesser

2. Who are the same/duplicate customer with quarterly index of 4 and more

answer should be somehow be the below which is able to highlight to me what the index difference in 1st cycle and 2nd cycle.

   

Customer Quarterly IndexCycle
A31st cycle
B41st cycle
C41st cycle
D21st cycle
A52nd cycle
B32nd cycle
C42nd cycle
D72nd cycle
12 Replies
tyagishaila
Specialist
Specialist

Try it,

aggr ( if (Quarterly Index<=3, '1stCycle' , '2ndCycle' ),Quarterly Index,Customer)

Not applicable
Author

using a table box or to put the script in backend (Load script portion?

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

Temp:

LOAD

Customer,

QuarterlyIndex

FROM Temp;

Data:

LOAD

*,

If(Previous(Customer) = Customer, QuarterlyIndex - Previous(QuarterlyIndex)) AS Diff;

LOAD

*

RESIDENT Temp

GROUP BY Customer, QuarterlyIndex;

DROP TABLE Temp;

Now in chart try like this:

Chart : Straight Table

Dimension: Customer, Diff

Expression: If(Diff <=3, '1st Cycle',  If(Diff > 3, '2nd Cycle')

Hope this helps you.

Regards,

Jagan.

tyagishaila
Specialist
Specialist

Check it,

if possible share qvw.

tyagishaila
Specialist
Specialist

Hi Jagan,

I tried it, but error generate

Data:

LOAD

*,

If(Previous(Customer) = Customer, QuarterlyIndex - Previous(QuarterlyIndex)) AS Diff;

LOAD

*

RESIDENT Temp

GROUP BY Customer, QuarterlyIndex;

Error: Aggregation expressions required by GROUP BY clause

Regards,

Shaila

jagan
Partner - Champion III
Partner - Champion III

Sorry, it is not Group By it is Order by.

Try like this

Temp:

LOAD

Customer,

QuarterlyIndex

FROM Temp;

Data:

LOAD

*,

If(Previous(Customer) = Customer, QuarterlyIndex - Previous(QuarterlyIndex)) AS Diff;

LOAD

*

RESIDENT Temp

ORDER BY Customer, QuarterlyIndex;

DROP TABLE Temp;

Now in chart try like this:

Chart : Straight Table

Dimension: Customer, Diff

Expression: If(Diff <=3, '1st Cycle',  If(Diff > 3, '2nd Cycle')

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

the chart expression does not work. it show a blank chart.

Not applicable
Author

sorry it works.

jagan
Partner - Champion III
Partner - Champion III

Calculating in script is an easier one.

Regards,

Jagan.