Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
etiennesan
Contributor III
Contributor III

Add a column to a table with a conditional sum

Hello everyone,

I have a problem that I have been trying to solve by looking at many solutions but couldn't find one that would work for me.

Here is the data: I have for many product ID, the inventory for each warehouse. Meaning I have a column for ID, one for warehouse, and one for the inventory.

I want to have a table showing the ID, as well as other information from other tables (for example description), and then split the inventory on different columns for each warehouse. Basically trying to do a pivot table, but I need to keep the versatility of a regular table.

I tried adding a column with the below formula but I'm getting an error.

=Sum(If(warehouse='/name of wh/', inventory))

Anyone has an idea on how to solve this issue?

Thank you very much!

Etienne

Labels (1)
1 Solution

Accepted Solutions
etiennesan
Contributor III
Contributor III
Author

Actually I have found the solution: the data should be added as a measure and not a dimension. Now I don't have any error.

View solution in original post

3 Replies
Vegar
MVP
MVP

You could try using set analysis instead of sum(if()). 

=Sum({<warehouse={'name of warehouse'}>} inventory)

etiennesan
Contributor III
Contributor III
Author

Hello, thank you for your reply.

I also tried this solution, but I get the same error: invalid dimension.

etiennesan
Contributor III
Contributor III
Author

Actually I have found the solution: the data should be added as a measure and not a dimension. Now I don't have any error.