Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
nich_olas
Contributor II
Contributor II

Qlik sense - Count the range in table

Hi,

I would like to know how can I count the range for status. Based on the example below, the result will be 1 IN, 2 OUT, 3 IN, 2 OUT. And the avg will be 2 IN and 2 OUT. Is there anyway to do this. Thank you.

Date Time Car Status
1/1/2018 0800H A In
1/1/2018 1000H A Out
1/1/2018 1800H A Out
2/1/2018 1730H A In
3/1/2018 0800H A In
3/1/2018 1700H A In
4/1/2018 0800H A Out
4/1/2018 1600H A Out
4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

How did you get this:

>>the result will be 1 IN, 2 OUT, 3 IN, 2 OUT

from your source data?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
nich_olas
Contributor II
Contributor II
Author

Hi,

Below is the sample data.

S/NDateTimePeriodCarStatus
11/1/20180700HAMAOUT
21/1/20181700HPMAIN
32/1/20180800HAMAOUT
42/1/20181600HPMAIN
53/1/20180600HAMAIN
63/1/20181730HPMAIN
74/1/20180830HAMAIN
84/1/20181800HPMAOUT
95/1/20180930HAMAOUT
105/1/20181400HPMAOUT
116/1/20181000HAMAIN

 

So based on the data, i would like to get the something like this

 Day(s)INOUT
1/1/2018-1/1/2018111
2/1/2018-2/1/20181 1
2/1/2018-4/1/201834 
4/1/2018-5/1/20182 3
6/1/2018-6/1/201812 

 

I need to find out the range between each IN and OUT or vice-versa.

Then get the Average range for IN and OUT.

jonathandienst
Partner - Champion III
Partner - Champion III

It's still not clear how you get from the data to the result. Please explain. The examples are useful to illustrate the explanation, but they are not an explanation by themselves.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
nich_olas
Contributor II
Contributor II
Author

Hi,

I count the number of IN before next OUT or vice versa. Which mean the no of IN/OUT to the next status change.

1/1/2018, there r 1 In and 1 OUT
On 2/1/2018, it has IN at 1600H and the status remain unchanged till 4/1/2019 at 0830H. Therefore there will be 4 IN.
On 4/1/2018, it has OUT at1800H and the status remain unchanged till 5/1/2018 at 1400H. Therefore there will be 3 OUT.