Kibana - How to create a visualization to show a duration per user? - elasticsearch

I have four columns :
timestamp
username
action
session_id
I would like to show / visualize for each user the average duration for all sessions.
That means that I have multiple lines for one session and that I have to get the duration per session to compute the average.
An example of data :
User Action Session_id timestamp
Fernando Login 1 1469087288
Fernando Draw Circle 1 1469087322
Fernando Draw Rectangle 1 1469087354
Fernando Login 1 1469087288
Chris Login 2 1469087323
Chris Draw Square 2 1469087424
Chris Draw Rectangle 2 1469087888
What I want is to get : User | Session_id | Duration
And the final result I want : User | Average duration / session
Is it possible easily ?

Upto the last vesion of kibana They didn't provided the facility to calculate the time duration of each term.
We can get aggregated count for the particular duration.

Related

Amazon QuickSight - Single Activity ID has Multiple entries - need to SUM one column but display only ONE VALUE from another column

I have been working on this for some time, but have come up empty.
I have a data set called 'Technical Assistance'.
In that data set, there is a column with the 'ActivityID', another column 'NumberAssisted', and a third column 'ContactHours'.
The issue is that for each ActivityID, there can be multiple entries, each with its own NumberAssisted and ContactHours.
Additionally, for EACH ACTIVITYID I need to show NUMBERASSISTED as a SUM, but only display CONTACTHOURS once (no sum, no calculation at all, just display).
In my example scenario, I have ONE Activity ID with FOUR entries - Each entry has a Number Served, and Contact Hours. By using SUM, I can get the correct Number Assisted (5), but cannot figure out how to get Contact Hours to display what I need. It SHOULD DISPLAY as 0.5 based on the scenario below:
ActivityID NumberAssisted ContactHours
101 1 0.5
101 1 0.5
101 1 0.5
101 2 0.5
TOTAL: 5 0.5
Thank you for any guidance!!
Troy

Running Sum of Filtered Rows in Tableau

I have a table of challenge submissions (that records the time of submission of a challenge in a competition by different players, and whether the submission was correct or not) -
and another table that has the points associated with each challenge -
How do I plot a graph of running sum of points earned by the top 3 players in the competition over time (for last 24 hours only)? The catch here is that I only need to consider the first successful submission in case there are more than one successful submissions for a challenge in the competition (eg. Challenge #17 for Player A).
EDIT:
Dummy Data
Desired Output:
I am proposing a solution/answer assuming a few things-
Challenge acceptance time ends at 17:00 everyday
Different lines represent different challenges
Step-1 Create a CF to adjust date/time by calendar date - adjusted date as
DATEADD('hour', 7, [Date])
Note that I have added 7 hours to make the last calendar date/time for submission as 00 AM next day.
Step-2 Create another CF win_loss as
If [Success]='W' then 1 ELSE 0 end
step-3 create another CF game points as
[win_loss]*[Points (Points)]
Step-4 create another CF first win or loss as (don't worry about loss here)
{FIXED [Player], [Challenge], [success] : MIN([Date])} = [Date]
Step-5 create a set on 'players' field with TOP-3 with this formula (select top 3) by
sum(
IF [first win or loss]= TRUE
then [game points] END)
Step-6 build your view by dragging
set, MDY(adjusted date) & first win or loss on filters shelf/card
add mdy filter to context
[date] with exact date and discreet to columns
sum(game points) to rows
adding table calculation on measure - running total
right click sum(game points) click edit in shelf and replace the existing calculation by this one-
RUNNING_SUM(ZN(SUM([game points])))
(Note this will ensure your lines start at f(x)=0 always)
challenge on colors in marks card
sum(game points) to text in marks card.
Note- filters on (i) Set will ensure the top 3 players are in view only
(ii) adjusted date will ensure view for 24 hour challenge submission time
(iii) first win or loss will eliminate second and subsequent win(s) by same player for same challenge
I hope this will also make things clear to you.
You should get your desired view
OR change the date field to seconds to get a view like this

I need to calculate difference between two datetime fields, THEN show a percentage based on the first calculation

I need to calculate the difference between the time a patient arrives for their appointment, and the time they check out, also displaying the default length of their appointment, THEN show the percentage of their default appointment time that was actually used.
I've calculated the first part:
,TRUNC(24*MOD(enc.CHECKOUT_TIME - enc.CHECKIN_TIME,1))|| ':' ||TRUNC(MOD(MOD(enc.CHECKOUT_TIME - enc.CHECKIN_TIME,1)*24,1)*60) AS "VISIT LENGTH"
The default appointment duration is in this field: enc.APPT_LENGTH. This is the part I'm not sure how to do - calculate the percentage of the APPT_LENGTH that was actually used (VISIT_LENGTH) as calculated by the above.
Thanks in advance for any assistance.
Your question is not very clear but, to get the actual duration of an appointment in hours (decimal system), you can use:
(enc.CHECKOUT_TIME - enc.CHECKIN_TIME) * 24 AS ACTUAL_DURATION
since using - with 2 dates in Oracle results in the difference in days between the 2 dates.
Now, if APPT_LENGTH contains the expected duration of the appointment in hours too, you can then use
(((enc.CHECKOUT_TIME - enc.CHECKIN_TIME) * 24) / enc.APPT_LENGTH) * 100 AS DURATION_RATIO
to calculate the ratio (in %) between the actual duration and the expected duration

Calculate Session Duration based on LogFiles in Kibana

I setup an ElasticStack and imported Millions of LogEntries. Each log entry contains a Tiestamp and a sessionID. Each session produces multiple log entries thus I have the following information available
SessionID | Timestamp
1234 | stamp1
1234 | stamp2
2223 | stamp3
1234 | stamp4
5566 | stamp5
5566 | stamp6
2223 | stamp7
Now I would like to calculate the average/minimum/maximum session duration.
Does anyone know how to achieve this?
Thanks in advance
To do exactly what you want isn't going to be simple, I'm not even convinced it's possible with your data in its current form.
I'm also not sure what having the average, minimum and maximum session lengths actually gives you in terms of actionable information - why do you need the max/min/avg session times?
Something that could be easily visualised using you data would be session count against a date histogram. From Kibana, create a line graph visualisation. On the y-axis do a unique count of the session ID, on the x-axis select date histogram and use your timestamp field...
I would have thought knowing the session count over a period of time would give you a better idea for capacity planning than knowing max/min session times - perhaps you have already done this? This assumes each session is regularly logging... If you zoom in too far (i.e. between log events) the graph will look choppy, but it should smooth as you zoom out and there are options available for smoothing.

Google SpreadSheet - handling MM:SS.sss time formats

I'd like to process the following columns in a google-spreadsheet. The Time column represents the minutes, second and milliseconds take to run 1km and I'd like to be able to sum the four values.
Split Time
1 3:13:4
2 3:20:5
3 3:16:1
4 3:26:3
I suspect that I need to convert and split the time column into a specific minute and second columns to achieve this goal but would appreciate any advise that the developer may have.
I updated the format of the time column and used the SPLIT / CONTINUE functions
Minutes=SPLIT(B2,":")
Seconds=CONTINUE(C2,1,2)
Total Seconds=(C2*60)+D2
The table now looks like
Split Time minutes Seconds Total Seconds
1 03:13:00 3 13 193
2 03:15:00 3 15 195
3 03:16:00 3 16 196
Still wondering about the most efficient way to convert the Total Seconds value to time.
You can use the LEFT(text, number), MID(text, start, number), and RIGHT(text, number).
In detail:
Minutes = LEFT(B2, 1)
Seconds = MID(B2, 3, 2)
Milliseconds = RIGHT(B2, 2)
You can just use SUM for those values, a la:
=SUM(A1:A4)
Alternatively, you can use functions such as HOUR, MINUTE and SECOND to extract appropriate values if you want more fine-grained control.
Where the source data is a specified (ie The Time column represents the minutes,second and milli seconds) then to be able to add to a sensible result (795.013 seconds for the first sample of four) conversion similar to:
=60*index(split(B2,":"),0,1)+index(split(B2,":"),0,2)+index(split(B2,":"),0,3)/1000
is required.
To convert the total (assumed to be in C6) to the same absurd format as for input (13:15:13):
=int(C6/60)&":"&int(mod(C6,60))&":"&value(mid(C6,find(".",C6)+1,3))
`
In your original sheet, in a new column:
=TO_DATE("00:0" & left($B2,4))
Then copy the formula down the column.
This will convert your M:SS (the left 4 characters of your data) to the sheet's system date/time format, for each entry in column B.
You can then sum and format the results as you like.
This assumes there are no leading zeroes on your data. You can add code to check for this, but if your times all have single digits for the minutes value, it won't matter.

Resources