7
votes

Duplicated data is coming in my report because source table has duplicate data. Without creating group, I want to hide duplicate data writing expression. So what I did: I select table row and put a expression for hidden property of table row.

The expression was like =(Previous(Fields!ID.Value) = Fields!ID.Value) but it did not work ... Still duplicate data is showing. So tell me how to suppress duplicate rows in ssrs writing expression not by grouping.

6

6 Answers

17
votes

You probably should try these options first:

  • Try to clean the duplicate data at the source.
  • Change your source query so the duplicates don't appear in the dataset. (e.g. SELECT DISTINCT)

If not, on the row's Visibility Hidden property you can use the Previous function:

=iif(Fields!YourField.Value = Previous(Fields!YourField.Value), True, False)

You would have to sort on the YourField column for it to work.

12
votes

I was putting the expression above also until I started using the "Hide Duplicates" line in the properties pane. You basically just select the row, in the dropdown choose your Dataset and that's it. any duplicates will be hidden. Also if you just want to hide certain textboxes duplicates you can do the same as i stated earlier except click on the textbox and not the row. Just another alternative, i'm aware you said using an expression.

7
votes

You can do it using expression or "Hide Duplicates" options from cell or row properties.

Expressions :

=IIF(Fields!YourField.Value = Previous(Fields!YourField.Value), True, False)

Hide Duplicates Steps:

  1. Select row or cell
  2. Click on F4 key on your Keyboard
  3. Look for "Hide Duplicates"
  4. Choose your DataSet from the dropdownlist

Done, I hope that helps

1
votes

As an alternative option, you can do it by setting row groups. In a report I was trying to create, the Hide Duplicates property wouldn't behave correctly because of using the same dataset multiple times in a list container.

All you need to do is set the row group properties for the default row group (rightclick the grey row header, and go to Row Group then Group Properties), and add Group expressions on the General tab. Add as many as you need for each field. It's like the Remove Duplicates tool in Microsoft Excel

0
votes

Sometimes the Hide Duplicates option does apply to the report content. If you add a =Sum(Field!Field_Name.Value) sum around field in the cell, it suppresses the copy from previous record. Of course, strictly speaking this is a solution where the incoming data set has NULL rows for the cells with the issue.

0
votes

Since the using of Previous function in SSRS compare to the only record previous to it, thus it might cause the duplicate of records still shown if the repeated records not next to each other.

Use the sorting on each table you apply the Previous function, it should resolve the "non next to each other" duplicate records as well.