Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am trying to limit the graph to show only certain times on the x-axis, but the formula doesnt seem to be working. this is what i am using:
=if(time(samptime) > '8:00:00 AM', time(samptime))
but QV is not recognizing it, and giving me all the times.
Thanks for your time in advance.
'8:00:00 AM' is a string literal. It can't be meaningfully compared to a time value. Here are some ways to get a comparable time value.
time#('8:00:00 AM','h:mm:ss TT')
maketime(8)
8/24
Edit: And looking more closely, you don't have a time field. You have a timestamp field. Using time() doesn't convert it into a time, it only DISPLAYS it as a time. Frac(samptime) should work.
I am on personal so I can not open your sample gvw, but have you tried something like
=if(time(samptime) > '8:00:00 AM', YOURVALUEFIELD)
where YOURVALUEFIELD is your expression?
I have something like this in mine to exclude invoices that are not related to sales orders. if(isnull(invoicemonthyear),0,sum(extprice) + sum(miscamt))
where YOURVALUEFIELD is my expression? i didnt get that.. can you please explain..
I am assuming that the dimension is set to Sample time correct? What field are you looking at for values on the graph?
In my example the value I was looking at was sum(extprice) + sum(miscamt).
Sorruy just re-read and I mis typed.
set YOURVALUEFIELD in that formula to the field that you are using for you values in the graph.
Paste this formula as the expression for the graph
That's what im trying to do actually:
=if(time(samptime) > '8:00:00 AM', time(samptime))
So im checking a field called samtime and if its more than 8 AM, then i want all the times after that.
but this isnt working for some reason, and its returning me all the times begn from 12 AM ..
'8:00:00 AM' is a string literal. It can't be meaningfully compared to a time value. Here are some ways to get a comparable time value.
time#('8:00:00 AM','h:mm:ss TT')
maketime(8)
8/24
Edit: And looking more closely, you don't have a time field. You have a timestamp field. Using time() doesn't convert it into a time, it only DISPLAYS it as a time. Frac(samptime) should work.
that was the entire problem it seems!
So this worked for me for everyones reference:
=if(frac(samptime) >= '6:00:00 AM' , time(samptime))
Huh! I did not realize that QlikView would automatically convert a string literal into a time in that situation. It looks like it MUST match the default time format set in the script, but as long as it does, it properly interprets it. I just learned something new.
I'd probably still recommend against it because you might, say, go and change your default time format, and forget to change all your string literals. The approaches I used above are not sensitive to your defaults like that. Still, interesting.