Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Qlikview Average calculation

Hi,

somehow I got stuck with simple math. Please see attachment. I don't get why "Dur" field calculation (average, dividing) is wrong.

That field is tagged $numeric

Thanks in advance,

Viesturs

8 Replies
bbi_mba_76
Partner - Specialist
Partner - Specialist

Hi,

maybe it is the group to multiply the count.

The result you are obtainng is 26847 / 4 / 86400

Not applicable
Author

Can you please explain what do you mean by "maybe it is the group to multiply the count."?

Somehow I don't get it why does Qlikview divide by that 86400?

bbi_mba_76
Partner - Specialist
Partner - Specialist

In the image I see the JobDefinitionTitle, and seems to be a cyclic group (or expression group?).

Maybe it is due to this group that you have the result/86400.

But without the qvw it is difficult to understand.

Not applicable
Author

Can you post a sample application? It will be easier to troubleshoot the issue with a qvw.

Not applicable
Author

I've attached sample file with scrambled data. You should see sample when open file (have to cycle group however).


Not applicable
Author

I can see in the sample file that you are using "Interval" function to get teh value of field Dur, which formats the expression as a time interval according to the string given as a format-code. If the format code is omitted, the time format set in the operating system is used (From qlikview Help ).

So, I don't think, the operation average and division will work in the similar way for a time interval as for any other integer/numeric value.

Not applicable
Author

Can you suggest how to get difference between two timestamps in seconds?

Not applicable
Author

To get the difference between 2 timestamps you can use an expression as :

 

=Time(Time(time#(Date_Num,'hhmmss'),'hh:mm:ss') - Time(now(),'hh:mm:ss'),'hh:mm:ss')

Where Date_Num is the field name and I have used function Now() to get another timestamp. You can replace them with your own field names.

Hope this helps!