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: 
manojkulkarni
Partner - Specialist II
Partner - Specialist II

How to find latest status for Cases

Hi Friends,

I have set of case IDs along with status per day in which i need to identify the distinct cases id with referred status only. The cases referred and closed on the same day should not be counted. Below is the sample data along with expected output.

Appreciate any suggestion

  

IDStatusDate
K1Referred02-11-2015
K1Closed02-11-2015
K2Referred02-11-2015
K3Referred02-11-2015
K3Referred02-11-2015
K4Closed02-11-2015
K5Open02-11-2015

Expected Output

 

IDStatus
K2Referred
K3Referred
1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

In Text Box

=Count({<ID=P({<Status={'Referred'}>})>} DISTINCT Status)

View solution in original post

10 Replies
its_anandrjs

Try this

MainTable:

Load * Inline

[

ID, Status, Date

K1, Referred, 02-11-2015

K1, Closed, 02-11-2015

K2, Referred, 02-11-2015

K3, Referred, 02-11-2015

K3, Referred, 02-11-2015

K4, Closed, 02-11-2015

K5, Open, 02-11-2015

];

Final:

Load

ID,Date,

If(ID = Previous(ID) and Status = Previous(Status), Status) as Status

Resident Where Status = 'Referred';


//This Drop table is optional

Drop Table MainTable;



Kushal_Chawda

Data:

LOAD ID,

           Status,

           Date

FROM table;

left join(Data)

LOAD ID,

           Cont(ID) as CntID

resident Data

group by ID;

Now you can use below expression in chart with ID as dimension

=only({<CntID={1},status={'Referred'}>} Status)

Kushal_Chawda

or on front end

Dimension:

ID

Expression:

= only ({<ID={"=count(ID)=1"},Status={'Referred'}>} Status)

antoniotiman
Master III
Master III

Hi Manoj,

try this

Only({<ID=P({<Status={'Referred'}>})>} Status)

Regards,

Antonio

rohitraut
Creator
Creator

Hello Manoj,

Try this,

In Calculated Dimension,

=Aggr(if(Status <> 'Closed'and Status <>'Open' and Status='Referred',ID),ID)

manojkulkarni
Partner - Specialist II
Partner - Specialist II
Author

Thanks Antonio, This worked. How can we get the count of referred cases ?

antoniotiman
Master III
Master III

In Text Box

=Count({<ID=P({<Status={'Referred'}>})>} DISTINCT Status)

effinty2112
Master
Master

Hi Manoj,

Another suggestion:

ID if(aggr(Concat(DISTINCT Status,','),ID,Date)= 'Referred',Status)
K2Referred
K3Referred

Cheers

Andrew

Kushal_Chawda

or try this

only ({<ID={"=count({<Status={'Referred'}>}ID)>=1"}>} Status)