Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
matzas
Contributor III
Contributor III

Hide expressions if no values

Is it possible to hide expressions when there is no values?

Fex: I want to hide "Female"

FemaleMale
xxxx043
xxxx041


Best regards

8 Replies
martin59
Specialist II
Specialist II

Hi,

You have the 'suppress when value is null' option in the dimension tab of the chart's properties

matzas
Contributor III
Contributor III
Author

Hi

Thanks.

I would use that if a "Dimension" has value null, but I want to do the same thing when an "Expression" have value null.

Best regards

Not applicable

I don't think it is possible, so I'm going to make a bad suggestion that would work on your example, but would be harder with a more complicated example. Make multiple charts. Have on that just shows Male, one that just shows Female and one with both. Then using the Conditional Show (Sum{<Gender={"Female"}> Value)>0) to show the one you want to see.

You could probably even come up with a complicated way to only need as many charts as you have expressions. One for one expression, one for two expressions, etc. And then just make the expressions dynamic based on what you want to show.

Like I said, not a very good suggestion. Big Smile

johnw
Champion III
Champion III

Attached are a couple of approaches using this data table:

LOAD * INLINE [
Type, Sex, Value
AAAA, Male, 43
BBBB, Male, 41
CCCC, Female, 52
];

Select types AAAA and BBBB to see the Female columns disappear.

The first chart is a pivot table. If there is no data for the column, it will naturally be removed in a pivot table, no special effort on your part.

The second chart is a straight table with separate expressions for Female and Male. It then uses a conditional show on the presentation tab, where the condition IS the expression. Therefore, if the expression evaluates to 0 or null, it won't display the column. This might not be EXACTLY what you want if there are negatives, since if the positives and negatives add to 0, it would also exclude the column. That can be fixed as well, but wouldn't be worth the extra trouble if you don't have negative values.

Not applicable

Is there any way to get this solution to work with a bar chart?

johnw
Champion III
Champion III

Well, in the example, the trivial way is to just make Sex a second dimension instead of using two expressions. We'll assume your real case isn't that simple.

One way I'm thinking to do it is make three charts (for the example). One with just female, one with just male, and one with both. Then only display the appropriate chart. That would get pretty ridiculous for anything more than a couple expressions, though, since you'd have to have a chart for every combination of expressions.

Ah, probably a better way to do it is with a valuelist. Make a value for each of your expressions. Then combine all your expressions into one with a pick(match()) to get the right expression.

See attached for all three solutions.

sandy2671
Partner - Contributor
Partner - Contributor

Thanks a Ton John,

This resolved my issue as well !!!

whiteline
Master II
Master II

The answer depends on what version of QV you use.