Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I'm a bit new to Qlikview, but I'm wondering if there is possible to work with the data i load, for example, if I load, data from to tables can I then in Qlikview calclulate, ex. amount = 12 and time = 2 and do 12/2 = 6 and then display 6. and so on?
Or do i need to make all calculations, modifications and so before loading it in to qlikview?
thanks in advance!
You can do it in Script and in objects in lots of ways
Yes you can do this
LOAD *,amount/time as Division;
LOAD * Inline
[
amount,time
12,2
];
And then take table box and add fields amount , time , Division
and also in front end you can calculate this values there are many ways.
thx!
just one more thing.. I have timestamps as an integer in minutes after midnight, for example. 432 is 432 minutes after midnight, ( 0.00 ) i need to convert this to time. which in this case will be 07:12
in php i can do it like this:
function tm($nm, $lZ = true){
$mins = $nm % 60;
if($mins == 0) $mins = "0$mins";
$hour = floor($nm / 60);
if($lZ){
if($hour < 10) return "0$hour:$mins";
}
return "$hour:$mins";
}
echo tm(432);
Can i use php scripts in qlikview? or how do i do this?
Divide by 60*24 and you'll have the fraction of a full day. You can show that as a time: time(MyTimeStamp/1440,'h:mm')
where do i use this? as an expression or where do i define that to an variable?
Whereever you need it. It's an expression. You can use it to create a new field in the script:
MyTable
load *, time(MyTimeStamp/1440,'h:mm') as MyNewField
from MySource;
Or in a chart expression, or in a variable that you then later use in an expression.
Hi again!
If i want to use loaded data from two loads in a new load to do a calculation. se example:
timestart:
LOAD
time(P_TIME/1440,'hh:mm') AS timestart,
Resident punches
Where P_TYPE=1;
timeend:
LOAD
time(P_TIME/1440,'hh:mm') AS timeend,
Resident punches
Where P_TYPE=2;
and then i want to take timeend/timestart AS totaltime to se the time lapse.
How do i do this?
Hi,
Looking at your script,
You can do the above thing in one table.
Like
Try this.
In your original table Which is i think punches write below code.
If(P_TYPE=1,time(P_TIME/1440,'hh:mm')) AS timestart,
If(P_TYPE=2,time(P_TIME/1440,'hh:mm')) AS timeend,
Then performed
Load
timeend/timestart AS totaltime
Resident punches
Regards,
I try this but not succesfull... i do get timeend undefined.
punches:
LOAD
P_DATE AS date,
P_TIME,
P_TYPE,
If(P_TYPE=1,time(P_TIME/1440,'hh:mm')) AS timestart,
If(P_TYPE=2,time(P_TIME/1440,'hh:mm')) AS timeend
FROM
[.....Punches.qvd]
(qvd);
Load
timeend/timestart AS totaltime
Resident punches
dont i need any type of else statement ?