Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count Responses

  Hi All

I Got Data (Test Data Below)

 

Ref  DateDirectionEmailAddress
110/10/2016oTest@1.com
109/10/2016iTest@1.com
210/10/2016oNew@1.Com
209/10/2016iNew@1.Com
208/10/2016iNew@1.Com

I want to count the responses -  so where direction is 'o' and Date is greater than Date with direction of 'i'

Any ideas how to do this in script?

Thanks

1 Solution

Accepted Solutions
sunny_talwar

Is this how you envision your final output?

Capture.PNG

Script

Table:

LOAD Ref,

    Date,

    Direction,

    EmailAddress

FROM

[https://community.qlik.com/thread/235827]

(html, codepage is 1252, embedded labels, table is @1);

Left Join (Table)

LOAD Ref,

  Max(Date) as Max_i_Date

Resident Table

Where Direction = 'i'

Group By Ref;

FinalTable:

LOAD Ref,

  Date,

  Direction,

  EmailAddress,

  If(Direction = 'o' and Date > Max_i_Date, 1, 0) as Flag

Resident Table;

DROP Table Table;

View solution in original post

4 Replies
sunny_talwar

Since Ref 2 has two row so data with direction i, which date do we compare to? What is the expected output here?

Anonymous
Not applicable
Author

Hi Sunny

The max in this case.

Thanks

sunny_talwar

Is this how you envision your final output?

Capture.PNG

Script

Table:

LOAD Ref,

    Date,

    Direction,

    EmailAddress

FROM

[https://community.qlik.com/thread/235827]

(html, codepage is 1252, embedded labels, table is @1);

Left Join (Table)

LOAD Ref,

  Max(Date) as Max_i_Date

Resident Table

Where Direction = 'i'

Group By Ref;

FinalTable:

LOAD Ref,

  Date,

  Direction,

  EmailAddress,

  If(Direction = 'o' and Date > Max_i_Date, 1, 0) as Flag

Resident Table;

DROP Table Table;

Anonymous
Not applicable
Author

Thanks buddy for the help!