Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In Qliksense script, how to convert the time format “0.00:00:54” in to 54 secs (i.e. the final result should be 0.9 min)? Because I need to use Avg, median later in the front end(Expression window), so need the final value as 0.9 like for above example. Please help to find the best solution. Thank you.
LOAD *,
Interval#(DateTime,'d.hh:mm:ss')*1440 as Minutes
Inline [
DateTime
0.00:02:53
0.00:00:54
];
hope this helps
Marco
This would be my approach
LOAD *,
num(Num#(TimeToSeconds) * 0.0166666667,'#.0') as SecondsToMinutes;
LOAD *,
Interval(Interval#(Time,'D.HH:MM:SS'),'SS') as TimeToSeconds;
DATA:
LOAD
'0.00:00:54' as Time
AutoGenerate(1);
Perhaps something like this
LOAD * ,
NUM(NUM#(SubField(MinutesAndSeconds,':',1)&'.'&SubField(MinutesAndSeconds,':',2)),'#.#') as MinutesAndSecondsToDecimal;
LOAD * ,
Interval(Interval#(Time,'d.hh:mm:ss'),'mm:s') as MinutesAndSeconds;
DATA:
LOAD
'0.00:02:53' as Time
AutoGenerate(1);
Hi Peter,
As per your new method, for this kind of values '0.00:02:53' its returning as 2.5 which is not correct and also for '0.00:00:54' its returning as 0.5(but 0.9 like before is the correct result).
Please check once and let me know the correct method to resolve this?
LOAD *,
Interval#(DateTime,'d.hh:mm:ss')*1440 as Minutes
Inline [
DateTime
0.00:02:53
0.00:00:54
];
hope this helps
Marco
Thanks MarcoWedel. It working charm!!
In Qliksense - we are using this VizlibCalendar filter purpose for Crd_Date field.
Now in the raw data(Crd_Date field) we have this format YYYY-MM-DD hh:mm:ss.
If we choose any date in the above calendar its showing wrong data like first date with different time values, etc..please let me know how to sort this out.