Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Class function

Hello community!

I just stared to use QlikView for my final thesis and even after reading several times some of the already existing posts and the Reference Manual, I am still facing some problems with the class function.

I am representing number of flights depending on the time of the day:

  • y-axes: number of flights (defined with the count function:  count (Departures))
  • x-axes: time of the day (from 0:00 to 24:00)

I would like to represent the flights every 30 minutes; for instance, a flight corresponding to 10:25, represented together with the flights from 10:30, a flight from 12:45, with the flights from 13:00.

I think that this could be done with a class function, but I don't really know how. I was trying with: class(count(Departures),00:30), but definitely it is not the way to do it.

Thank you in advance for your help

6 Replies
Not applicable
Author

Only to clarify, what I would like to have is a frequency graph.

lironbaram
Partner - Master III
Partner - Master III

hi check the attach example

Not applicable
Author

Thank you a lot for your answer, but I am working with a personal edition, which doesn't allow me to open other users' qvw files.

lironbaram
Partner - Master III
Partner - Master III

hi attach is file with deom data

load it to a qlikview file

then create new bar chart

in the dimension  add calulated dimension with this formula

=

time(left(class(aggr(DepartureTime,flightnumber),0.5/24),Index(class(aggr(DepartureTime,flightnumber),0.5/24),'<')-1),'hh:mm')

then add an expression with this formula

count

(flightnumber)

hope it helps you

Not applicable
Author

Thanks Liron, your aswer helped me to understand better this function and how to deal with the time. The result that your solution gives is exactly what I am looking for, but now the issue is that I only have one field: the Departures_Time, so instead of counting flight numbers, I am counting departure times (more precisely how many times a departure time appears in my data set).

I am trying to use your formula like following:

Calculated dimension:

=
time(left(class(aggr(Departure_Time),0.5/24),Index(class(aggr(Departure_Time),0.5/24),'<')-1),'hh:mm')

Expression: count (Departure_Time)

But no data is displayed in the graph.

I really thank you for any new suggestion you could give me.

lironbaram
Partner - Master III
Partner - Master III

in order to get the  number right

i suggest that in the load you will add index filed

add to the load script new field

when your load script should look like

load

Departure_Time,

rowno() as filghtnumber

from yourfile

then you can use the formula i sent or change your expression to

time(left(class(aggr(Departure_Time,Departure_Time),0.5/24),Index(class(aggr(Departure_Time,Departure_Time),0.5/24),'<')-1),'hh:mm')