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

Hide columns in pivot table based on sum

Hi,

I've encountered a problem with a pivot chart where I would like to hide columns (dimensions) that only contains null values or zero values (i.e only show columns where the total column sum > 0) Closest I've got is simply to suppress zero-values which works as I want it to for the columns, problem is it also hide the rows that are zero as well. Is per the table below, I would like to hide the column "After sales" since it only contain blank values but keep the Item2 row visible even though it would also sum 0.

Stock profile1020
Stock profile nametentwenty
ItemDescriptionStock nameAfter salesMain stockConsignment
Item1aa-10
Item2bb00-
Item3cc-01
Item..ndd010

Thank in advance

Finn

3 Replies
marcus_sommer

You could try it with a condition on this column like: sum(TOTAL [After sales]) and/or a calculated dimension like: aggr(if(sum([After sales])>0, Item), Item) and/or a condition within the expression itself like: if(sum([After sales])=0, null(), sum([After sales])) and using the suppress zero-option but not each view-combination will be (practically) possible.

- Marcus

Not applicable
Author

Hi Marcus and thanks for your response.

I don't think placing a condition on the "Stock name" Dimension will work since this will hide either all or none of the stock places (After sales, Main stock, Cons)

Neither do I think suppress zero-values will work regardless of the expression since I want the pivot to suppress zeroes on columns but now rows, and there is no such distinction in the chart options.

Your suggestion to add a calculated dimension got me thinking and I ended up making a calculated dimension that summarized the total "stock name" balance and display it pivoted "below" "stock name". By placing a condition on the summary where it returns null() if the sum is 0 I could use suppress if value is null on the dimension and almost achieve what I wanted. The only flaw is that it will still remove rows (items) with 0 stock balance where the column summary is 0 (null), though this is pretty rare.

aapurva09
Creator
Creator

Hi,

To achieve this, we can use set analysis in the expressions and remove null from the expression only. By doing this, the field values in the dimension where there is a null will automatically get removed.

The set could be like this:

=sum({<Stock={"=sum(Sales)>=0"}>}Stock)

Thanks