How to group this SSRS report?

I have an SSRS report. It looks like this:

enter image description here

Its definition is as follows:

enter image description here

As you can see, this is just a bunch of numbers in different columns from A to G. These numbers were grouped by A, then B then C. For each row in the report, columns D, E, F, G are my detailed data. The problem is so that for each group (I mean grouping by A, B, C) I need all the rows for column D & E. For column F & G, I don't want duplicates. So, for example, for the first group, we see that there are duplicates for the F & G column, data 20, 30 are displayed twice. Essentially, I want something like this (note that duplicates have been removed compared to the above report result):

enter image description here

, , , . , SSRS. , - . , https://www.dropbox.com/s/qxvloaeuj31m0mj/Report1.rdl?dl=1. , , . . .

+4
2

. , , , , .

RDL, . ! .

SQL - , , . , , , . , temp , / . , .

SQL RDL, .

SELECT *
INTO #Report
FROM (VALUES(1,4,1,1,10,20,30),
(1,4,1,2,11,20,30),
…
(22,666,7,14,23,150,6)
) AS t(A, B, C, D,E,F,G);

SELECT A.A, A.B, A.C, A.D, A.E  -- selecting columns A thru E
FROM #Report A 

UNION ALL

SELECT DISTINCT B.A, B.B, B.C, B.F, B.G  -- union in columns F and G
FROM #Report B
ORDER BY 1, 2, 3

DROP TABLE #Report

: SELECT INTO, . , UNION , ; DISTINCT, .

RDL, , F G Tablix SQL . , Tablix .

enter image description here

, , . temp, 2 .

. ; . temp DDL :

CREATE TABLE #Report (A int, B int, C int, D int, E int, F int, G int)

.

INSERT INTO #Report
EXEC usp_MyStoredProcedure

, SELECT INTO , . .

, , , SQL .

CREATE TABLE #Report (A int, B int, C int, D int, E int, F int, G int);

INSERT INTO #Report
EXEC usp_MyStoredProcedure;

SELECT A.A, A.B, A.C, A.D, A.E  -- grabbing columns A thru E
FROM #Report A 
UNION ALL
SELECT DISTINCT B.A, B.B, B.C, B.F, B.G  -- union in columns F and G
FROM #Report B
ORDER BY 1, 2, 3

:

enter image description here

, .

+3

SSRS, SQL, .

  • (Details) Add Group > Adjacent After....
  • Tablix Group Group [F]
  • (F) " ".
  • Group on [G]. (, FG).
  • F G ( FG) .

, .. D E. FG F G A/B/C.

Preview Report1 with FG added

+2

Source: https://habr.com/ru/post/1675322/


All Articles