Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Fill missing data

I am analysing some connection stats and need to know how many unique users are logged on each day. Some sample data is attached.

The problem I have is that a user's session may start on a Monday and end on a Friday, therefore I need to include all days from when their session started, through to when it ended.

How on earth do i go about doing that?

Can I do it in chart? Or do I need to do something in the dataload beforehand?

21 Replies
Not applicable
Author

Sorry, what eaxctly do you mean Jagan?

jagan
Partner - Champion III
Partner - Champion III

Hi,

You create a list boxes for SessionClosedDate and SessionClosedTime fields and check whether you got any values into it.  Can you attach some sample file with some data?

Regards,

Jagan.

Not applicable
Author

Yes, there is data

Sample data attached

Not applicable
Author

Hi henric,

As I mentioned to Jagan, that was actually a typo. My script does contain the ;

The full script is:

My full script is below which still gives the error

UserSessionDetails:

LOAD UserName,

    SessionId,

    Environment,

    Replace(DisconnectionReason, 'ClientConnectionClosed. Reason:','') As DisconnectionReason,

Date(DayStart(Date(SessionStarted,'DD/MM/YYYY')),'YYYY-MM-DD') As SessionStartedDate,

  MakeTime(Hour(SessionStarted), Minute(SessionStarted), Second(SessionStarted))  As SessionStartedTime,

  Hour(SessionStarted) As SessionStartedHour,

    SessionStarted,

Date(DayStart(Date(SessionClosed,'DD/MM/YYYY')),'YYYY-MM-DD') As SessionClosedDate,

  MakeTime(Hour(SessionClosed), Minute(SessionClosed), Second(SessionClosed))  As SessionClosedTime,

  Hour(SessionClosed) As SessionClosedHour,

    SessionClosed,

    FlashPlayer,

    Firm,

    IPAddress,

    TestAccount,

    Disconnection,

    Reconnection,

    GeneralOutage,

    FirmOutage,

    WorkingDayDisconnect,

    WorkingDayReconnect;

SQL SELECT *

FROM dbo.usersessiondetails;

UserSessionDetails_x_Dates:

Load UserName,

          Date( SessionStartedDate + IterNo() – 1 ) as ReferenceDate

          Resident UserSessionDetails

          While IterNo() <= SessionClosedDate - SessionStartedDate + 1 ;

Not applicable
Author

I worked out the problem, the first dash wasn't recognised as a minus sign for some reason. Having copied it from Henric's blog it pasted as a dash rather than a minus sign

Not applicable
Author

I worked out the problem, the first dash wasn't recognised as a minus sign for some reason. Having copied it from your blog it pasted as a dash rather than a minus sign

Not applicable
Author

I have just realised a slight problem I have is that the SessionClosed date is sometimes blank.

If I wanted to assume a blank value was today. How would I do that?

Not applicable
Author

I have just realised a slight problem I have is that the SessionClosed date is sometimes blank.

If I wanted to assume a blank value was today. How would I do that?

MarcoWedel

If(IsNum(SessionClosedDate), SessionClosedDate, Today()) as SessionClosedDate 


just like used in my solution ...


regards


Marco

Not applicable
Author

Thanks Marco

but how do I combine it with my existing script?

UserSessionDetails:

LOAD UserName,

    SessionId,

    Environment,

    Replace(DisconnectionReason, 'ClientConnectionClosed. Reason:','') As DisconnectionReason,

    Date(DayStart(Date(SessionStarted,'DD/MM/YYYY')),'YYYY-MM-DD') As SessionStartedDate,

  MakeTime(Hour(SessionStarted), Minute(SessionStarted), Second(SessionStarted))  As SessionStartedTime,

  Hour(SessionStarted) As SessionStartedHour,

    SessionStarted,

    Date(DayStart(Date(SessionClosed,'DD/MM/YYYY')),'YYYY-MM-DD') As SessionClosedDate,

  MakeTime(Hour(SessionClosed), Minute(SessionClosed), Second(SessionClosed))  As SessionClosedTime,

  Hour(SessionClosed) As SessionClosedHour,

    SessionClosed,

    FlashPlayer,

    Firm,

    IPAddress,

    TestAccount,

    Disconnection,

    Reconnection,

    GeneralOutage,

    FirmOutage,

    WorkingDayDisconnect,

    WorkingDayReconnect;

SQL SELECT *

FROM dbo.usersessiondetails;

Sorry for all the questions. This is all a little new to me!