I want hide a column in SSRS report based on the Field value, the field value may differ, but in one detail it will be unique.
If the field value is 'A' i want to hide 'col1', in the second detail field value may be 'B', in that case the coumn should be visible. When i tried to write expression in column visibilty , it didnt work, it only works when all the records have the value 'A'.
I couldn't get the requirement clearly from your explanation. But if you are looking for expression to show or hide column based on the distinct values in the column try the below
=IIF(CountDistinct(Fields!name.Value) = 0,True,False)
If this doesn't work , please provide as more details with sample data and screen shots (preferably) to get further faster assistance.
Best Regards Sorna
So are you telling that at the same detail level you want a column to be shown in some cases and hidden for the other?
If yes, that not possible. you can only blank the column contents or show it based on your condition but column will always be present.
If its in a different level then its possible based on value of field in parent group.
Name | Age | Sex | Time IN | Time OUT
anil 23 M
In this case if the dataset field value have Field Say TimeSelected = AM, then need to show only Time IN column, if TimeSelected = PM then need to show only Time OUT coulmn, if TimeSelected = Both , need to show both column.
In the column visibilty of Time IN i write like below
=IIF(Fields!TimeSelected .Value = "PM",True,False)
In the column visibilty of Time OUT i write like below
=IIF(Fields!TimeSelected .Value = "AM",True,False)
It will work only if all have TimeSelected AM only or PM only , When mixed with AM and PM and Both, column was not hiding.
How do you select field from AM or Pm or both? Do you mean Report Parameter?
If so, you need to change the visibility criteria from field to parameter.
Try to change your visibility expression something like
=IIF(Parameter!TimeSelected.Count = 1 AND Parameter!TimeSelected.Value = "PM",True,False) for Time IN and =IIF(Parameter!TimeSelected.Count = 1 AND Parameter!TimeSelected.Value = "AM",True,False) for Time OUT