Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blank out duplicate column values in SQL Reporting Services

This has to be stupid easy to do, but I'm not seeing it.

I have a SQL Reporting Services (SQL 1008 R2) report.

I'm using a tablix to basically show:

COL 1 |  COL 2 |  COL 3 |  COL 4
----------------------------------
100   |  100   |  100   |  Item 1
100   |  100   |  101   |  Item 2
100   |  100   |  102   |  Item 3
100   |  110   |  110   |  Item 4
100   |  110   |  110   |  Item 4
100   |  110   |  111   |  Item 5
100   |  110   |  112   |  Item 6

But I want to suppress repeating values in those first two columns so it looks like this:

COL 1 |  COL 2 |  COL 3 |  COL 4
----------------------------------
100   |  100   |  100   |  Item 1
      |        |  101   |  Item 2
      |        |  102   |  Item 3
      |  110   |  110   |  Item 4
      |        |  110   |  Item 4
      |        |  111   |  Item 5
      |        |  112   |  Item 6

I thought it might be as easy as right clicking the column and selecting "Hide duplicate values", but I'm not seeing that. I'll apologize now because I'm going to feel stupid when someone points out how easy it is to do or find.

like image 358
tidge Avatar asked Oct 17 '12 18:10

tidge


People also ask

How do I exclude a duplicate column in SQL?

It records inaccurate data and is also unable to fetch the correct data from the database. To remove the duplicate columns we use the DISTINCT operator in the SELECT statement as follows: Syntax: SELECT DISTINCT column1, column2, ...

How do you display without duplicate records in SQL?

If you want the query to return only unique rows, use the keyword DISTINCT after SELECT . DISTINCT can be used to fetch unique rows from one or more columns. You need to list the columns after the DISTINCT keyword.


1 Answers

It is probably best to simply use groups, but if you want to keep it this way, try:

=IIf(Previous(Fields!Col1.Value) = Fields!Col1.Value, Nothing, Fields!Col1.Value)

Or you can set the textbox's HideDuplicates property to the containing group name (in your case, presumably Tablix1_Details)

like image 176
lc. Avatar answered Oct 13 '22 01:10

lc.