Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
mhmmd_srf
Creator II
Creator II

Division Calculation is not working

Hi All,

I have below table on my present data set.

See very first row. I want Duration/Count = 58/1 = 58 and similarly for other rows. And In summary level also it is sum(duration) / count(number). But this is showing some weird value.

My Script:

Duration = Interval([closed_at] - [sys_created_on] ,'mm')

Number Count = count(number)

Duration/Count = Interval([closed_at] - [sys_created_on] ,'mm')/count(number)

Could you please help on this.

Thanks,

Sarif

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Your fields closed_at and sys_created_on are timestamp fields. Timestamp fields have numeric value and the unit of those values is in days. If you subtract two of those values you get a result that's also in units of a day. The interval function doesn't change the numeric value, but only the way it is displayed.

A day has 24 hours. An hour has 60 minutes. So a day has 24*60 = 1440 minutes.


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Duration is really a number that's a fraction of a day. You merely format it so it shows as minutes. The actual value is 1440 times less (24 hours * 60 minutes). So multiply Duration/Count with 1440 and you'll see the numbers you expect.


talk is cheap, supply exceeds demand
beck_bakytbek
Master
Master

Hi Mohammad,

check this: Evaluate() Function

i hope that helps

beck

mhmmd_srf
Creator II
Creator II
Author

hi gysbert..it is matching..however I could not understand the logic. It would be really helpful if you can explain it in details.

Thanks,

Sarif

looking for your reply... 

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Your fields closed_at and sys_created_on are timestamp fields. Timestamp fields have numeric value and the unit of those values is in days. If you subtract two of those values you get a result that's also in units of a day. The interval function doesn't change the numeric value, but only the way it is displayed.

A day has 24 hours. An hour has 60 minutes. So a day has 24*60 = 1440 minutes.


talk is cheap, supply exceeds demand
mhmmd_srf
Creator II
Creator II
Author

thanks dear..this is helpful ...