Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
vanir88
Creator
Creator

How to count session ids based on start and end date

Hi,

i have a requirement that 

county, session ID , start date, finish date,

now i have to calculate session id count for each country based on both ( start date, finish date,)

eg: in below table required, country  and count (session ID) which is having both start date and end date.

we can say like "Number of SUCCESSFUL sessions ( successful means the id which is having finish date also)

session ID country start date finish date
aaaaa ind 2023-01-01T11:21:03Z 2023-01-01T11:34:38Z
ssssss us 2023-01-05T17:20:33Z  
ddfd ind 2023-01-04T00:35:11Z 2023-01-04T00:42:21Z
wwww uk 2023-01-03T11:23:28Z  
Labels (2)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Create a flag field during data reload in the Data Load Editor as below

 

Load 

SessionID

,Country

,StartDate

,EndDate

,if(len(StartDate) and len(EndDate),1,0) as flag_session

From XyzSource;

 

Then use expression

=Count({<flag_session={1}>}Distinct SessionId)

 

OR if you are unable to create a field, try below

=Count({<SessionId={"=len(StartDate)>0 AND len(EndDate)>0"}>}Distinct SessionId)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

2 Replies
vinieme12
Champion III
Champion III

Create a flag field during data reload in the Data Load Editor as below

 

Load 

SessionID

,Country

,StartDate

,EndDate

,if(len(StartDate) and len(EndDate),1,0) as flag_session

From XyzSource;

 

Then use expression

=Count({<flag_session={1}>}Distinct SessionId)

 

OR if you are unable to create a field, try below

=Count({<SessionId={"=len(StartDate)>0 AND len(EndDate)>0"}>}Distinct SessionId)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vanir88
Creator
Creator
Author

thank you it worked i have given in expression of session ID