Blessed
Blessed

Reputation: 55

SSRS Alternate data into two columns

and so on. My data are like this in SSRS.

A
1
B
2
C
3
D
4
E
5
It means that I have one column and I want to display into two columns and alternate date from one column to another. I should display row 1 into first column and row two into second column, row three in first column, row 4 into second column: And I want them to be presented into columns like this:

A 1
B 2
C 3
D 4
E 5

Thank you in advance

Upvotes: 1

Views: 317

Answers (1)

Hannover Fist
Hannover Fist

Reputation: 10860

The way I have done this is to add a row number to the data and then use a MATRIX with the columns grouped by =Fields!ROW_NUM.Value MOD 2 and rows grouped by =INT((Fields!ROW_NUM.Value + 1) / 2).

The MOD expression will group your columns into 0 and 1 for the two columns - MOD gives the remainder after division.

The INT(Row) / 2 will group the data into groups of two.

You can add a row number column to your SQL with something like

ROW_NUMBER()OVER(ORDER BY LETTER, NUMBER) AS ROW_NUM

Upvotes: 1

Related Questions