4

I need to hide column if all rows in column is empty (blank).

In this case col3 should be hidden, because no values in column.

col1 col2 col3
 v1   v4
 v2
 v3   

I'm using following expression on columns Hidden property:

=IIF(Fields!Test5.Value = "",TRUE,FALSE)

This expression working, but It hidding each blank(empty) field, even all column isn't empty. It should hide column only when there is no values at all.

3 Answers 3

8

You can use:

=IIF(Max(Field, Dataset)= "",TRUE,FALSE)

If the maximum value is empty it means that there is nothing, and make your hide expression on column.

2
  • Please reference directly to dataset, ie: =Max(Fields!InvoiceID.Value, "SalesInvoiceDS") We are referencing to the "whole" dataset values, not current tablix context
    – sdrzymala
    Mar 2, 2015 at 9:35
  • @sdrzymala this is great. Thanks a lot! I just want to mention that if you want to hide the column use the Visibility field and not the Hidden one.This way, when the column is empty, no gap will be present. So, in case of a tablix, right click on the column, choose Column Visibility and write down the above expression below "Show or hide based on an expression". Jun 2, 2016 at 9:04
4

in case of an SSRS report, right click on the column and click Textbox Properties, choose Column Visibility and write down the below expression on "Show or hide based on an expression"

You can use below if the column value is Null:

=IsNothing(Fields!Column.Value) 
1
  • This does not answer the question of hiding if all values in the column are empty. At best, if it works at all, this will silently get the first value (implied First()) and wrongly hide based on that. May 28, 2019 at 8:45
0

For me this worked

= IIF(Max(Fields!Test5.Value)= "",TRUE,FALSE)

Notice that I have not added Dataset name in here.

2
  • Note that this is exactly the code that OP already tried. Nov 27 at 9:29
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Nov 27 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.