Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Table Chart

Hi Guys

I am trying to build a table chart and have several columns to sum sales by department.

what expression should I use to build it.

Like in the chart expressions I have Sum(Sales) which gives me the total sales for all departments

I tried to add in the definition

Sum(Sales) where department = A

Note that i have a list box w all the departments and I am required to build a table and show a column for each department.

thank you in advace.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

So you have one dimension Date and two expressions, right?

try this as expression 1:

=sum(if(department= 'Dept1',Sales))

and for expression 2:

=sum(if(department= 'Dept2',Sales))

Does this give you correct data if you don't select anything in field department?

You could also use two dimensions, Date and department and use a pivot table chart, pivoting e.g. department to the top and using sum(Sales) as expression.

Instead of above if() inside the sum, you could also use set analysis, but first try with one of the suggested.

regards,

Stefan

View solution in original post

4 Replies
swuehl
MVP
MVP

Hi

have you tried using a straight table chart with dimension department and expression =sum(Sales) ?

This should give you sum of Sales per department. Use similar expression for other measures per department.

Hope this helps,

Stefan

Not applicable
Author

I am using a straight table but I have to have the following columns

column 1: Date

Column 2: Dept1

Column 3: Dept 2

and so on.

I was able to add the date and the departments.

and i added If statement to the expression

I am not able to display the data.

however I added a department list box  and if I select one department I get its data and if I select more than once I dont see anything!

Any ideas

swuehl
MVP
MVP

So you have one dimension Date and two expressions, right?

try this as expression 1:

=sum(if(department= 'Dept1',Sales))

and for expression 2:

=sum(if(department= 'Dept2',Sales))

Does this give you correct data if you don't select anything in field department?

You could also use two dimensions, Date and department and use a pivot table chart, pivoting e.g. department to the top and using sum(Sales) as expression.

Instead of above if() inside the sum, you could also use set analysis, but first try with one of the suggested.

regards,

Stefan

Not applicable
Author

Thank you Stefan!

I have used the pivot table and it works perfect however i am really interested in knowing the other solution "If  insode the sales epression ".

I appreciate your time.