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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Mr_Pearl
Creator II
Creator II

Expression to sum hours in bar chart

I have column "Mx" with minutes as numbers and have column "sold (yes/no)" with number of items sold. When an item is sold, "sold (yes/no)" column will have "1" otherwise "0".

I want to create a bar chart with hours in x-axis and number of Total items sold at a given hour in y-axis.

At the moment I got

dimension as hours "=interval(Mx/60,'h')" and

Measure as "Count(sold (yes/no))"

Above expression results in repetition of x-axis values (please see the attached image). How do I consolidate x-axis and display total count of sales every hour?

 
Labels (2)
1 Solution

Accepted Solutions
MayilVahanan

HI @Mr_Pearl 

Either you can bring one field in script

interval(Floor(Mx/60),'h') as Hour

or try with floor function

=interval(Floor(Mx/60),'h')

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

1 Reply
MayilVahanan

HI @Mr_Pearl 

Either you can bring one field in script

interval(Floor(Mx/60),'h') as Hour

or try with floor function

=interval(Floor(Mx/60),'h')

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.