New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for
Search instead for
Did you mean:
Contributor II

Occurrence Count of Items

I have a Excel data Sheet like This

 Wagon Date Status A 01/01/2021 In Travel A 02/01/2021 Stopped A 03/01/2021 Stopped A 04/01/2021 Stopped A 05/01/2021 In Travel A 06/01/2021 Stopped A 07/01/2021 Stopped A 08/01/2021 In Travel A 09/01/2021 Stopped A 10/01/2021 In travel A 11/01/2021 In travel

Now I want to calculate the number of occurrences of Stops which is (3) but not the count of Stops which is (6)

Thanks in advance

3 Replies
Specialist II

Hi

Add in your script a flag :

somethink like that :

if(match(Status,'Stopped'), if(Status<>previous(Status),1,0)) as count,

than in your app as mesure :

Sum( count)

see below example :

[Table]:
[Table]:
load *,
if(match(Status,'Stopped'), if(Status<>previous(Status),1,0)) as count;
LOAD * INLINE
[
Wagon,Date,Status
A,01/01/2021,In Travel
A,02/01/2021,Stopped
A,03/01/2021,Stopped
A,04/01/2021,Stopped
A,05/01/2021,In Travel
A,06/01/2021,Stopped
A,07/01/2021,Stopped
A,08/01/2021,In Travel
A,09/01/2021,Stopped
A,10/01/2021,In travel
A,11/01/2021,In travel
](delimiter is ',');

Contributor II
Author

Thanks

I didnt test you solution yet

but there might be a B or C wagons between As

Specialist II

Hi

then as mesure use aggr function

agrr(sum(count),wagon) to group stopped occurence per wagon

Tags
Community Browser