Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
ashis
Creator III
Creator III

How to show second in chart

Hello ,

I have two time column and I am calculating second using the following syntax, in the bar chart.

=Interval(End_Time - Start_Time,'ss')

I am getting the proper time in second in the chart in numeric format, now I want to print second text in the chart such as

30 sec , instead of 30 .

in the number tab if I change format setting from expression default to interval and put ss second , I did not get the result.

Could you please help me how to get it.

Thank you,

Ashis

34 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

=Round((End_Time - Start_Time) * 86400) & ' sec'

(86400 is number of seconds per day 24*60*60)

Interval() does not change the underlying value to seconds - it simply formats the display to seconds...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
antoniotiman
Master III
Master III

Check this

Anil_Babu_Samineni

My bad, multiply with 24 Hours in day

=dual(Interval(End_Time - Start_Time,'hh:mm:ss')*24*60*60 & ' Sec',Interval(End_Time -Start_Time,'ss'))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ashis
Creator III
Creator III
Author

Hi Anil,

It did not change the output for me.

ashis
Creator III
Creator III
Author

Than you jonathan,

I am calculating time difference in second that is why using interval.

you are right it is giving me correct numeric value , however I want sec in the following .

=Round((End_Time - Start_Time) * 86400) & ' sec'  this syntax is not giving me any value in the chart.

tresesco
MVP
MVP

ashissau‌,

Have you tried taking Jonathan's suggestion into account like:

Dual( Round((End_Time - Start_Time) * 86400) & ' sec' , Round((End_Time - Start_Time) * 86400) )

?

jonathandienst
Partner - Champion III
Partner - Champion III

Are End_Time and Start_Time valid numeric date value? If so, then (End_Time - Start_Time) gives the interval in decimal days, which can be multiplied by 24*60*60 to give the interval in seconds.

If you are not getting any data, then it seems that End_Time and/or Start_Time are not proper date values, or they are not unique in the dimensional context in which you are evaluating them. If the latter, you will need to use Min(Start_Time) and Max(End_Time) (or something similar) in the expression.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
hari8088
Creator
Creator

In the chart properties Number tab go to format pattern give seconds after normal pattern

normally it will be hh:mm:ss TT  instead of these format give like ss seconds

ashis
Creator III
Creator III
Author

Yes I tried that too. it did not work,

The strange thing is dual syntax is giving me correct result if I am choosing combo chart but if I choose

bar chart sec is not appending after the second value. not sure why.

ashis
Creator III
Creator III
Author

I tried the following syntax

Dual( Round((End_Time - Start_Time) * 86400) & ' sec' , Round((End_Time - Start_Time) * 86400) )

this is giving me correct output if I am using combo chart  but if I change it to bar chart sec is gone and the value is like the following  217, 219 etc. i want it to be 217 sec .

Any idea why?