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

Sum by Expression in Chart

Hi All,

I'm in QlikView 11 and I want to display the sum of one column of data in a table chart, but am having trouble with the expression.

Here's a sample of my data:

StatusHours
Open6
Open5
Open8
Open2

Closed

5
Closed6
Closed3

I want to display the total number of open hours

Open Hours
19

Right now I'm trying to do this using a table chart. I can get the sum by status easily enough, but I can't filter for open. Here's the expression I'm using:

Sum({Status = 'Open'} [TOTAL [Hours])

This is the template that pops up for expressions, but I'm lost on how to translate it into what I'm trying to do:

Sum ({[SetExpression][DISTINCT][ALL][TOTAL[<fld{, fld}>]]} expr)

Thanks in advance for any and all help!

1 Solution

Accepted Solutions
Not applicable
Author

Whoa! My QlikView world just blew open!

"anywhere you see an ellipses (…) in QlikView you can insert an expression."

Here's how to use a text box to display a calculated field:

1. In the "text" section under the general tab, enter your formula:

= num(Sum({<Status = {'F'}>} TOTAL [Total Status Hours]),'#,##0')

Boom! You've got a text box with your calculated field. Gorgeous!

Thank you guys for your help, I would still have been stuck without the formula suggestions!



View solution in original post

6 Replies
sushil353
Master II
Master II

Hi,

Try below code:

Sum({<Status = {'Open'}>} [TOTAL [Hours])


HTH

Sushil

ecolomer
Master II
Master II

I think the expression is:

Sum({<Status = {'Open'}>} TOTAL [Hours])

Not applicable
Author

Thanks guys, that got me to the right value, but it displays the sum of the open hours for all statuses:

StatusHours
Open19
Closed19

How can I suppress this to only show the open status?

Thanks!

Agis-Kalogiannis
Employee
Employee

Hi Katherine

You can work in two different ways:

1. By adding a List box for the Status field and add the expression sum(Hours) in it

2. By creating a calculated dimension in a straight table and use the aggr() function, together with the sum(Hours) function.

Please check the attached example

Regards

Agis

Not applicable
Author

Whoa! My QlikView world just blew open!

"anywhere you see an ellipses (…) in QlikView you can insert an expression."

Here's how to use a text box to display a calculated field:

1. In the "text" section under the general tab, enter your formula:

= num(Sum({<Status = {'F'}>} TOTAL [Total Status Hours]),'#,##0')

Boom! You've got a text box with your calculated field. Gorgeous!

Thank you guys for your help, I would still have been stuck without the formula suggestions!



Agis-Kalogiannis
Employee
Employee

Right.

I though you actually wanted to show all the possible status values there in a table.

Glad you found it! 🙂