How to show data in column in SSRS - sql-server

I'm using SSRS for my reporting, my reporting solution is in Visual Studio 2008 Business Intelligence Development Studio.
I have a report in which the data should be displayed in this format.
I have added a Column Group in my table which is having the values of Customer Name and details, the data is coming fine in the vertical format i.e column after column.
My Issue :
There should be only three columns in each row, after three records the next row should begin and again not more than three records should be displayed as shown in the image above.
My attempts :
I tried to add a row group and in that gave the expression
= Ceiling(Fields!Row_Count.Value/3)
here Row_Count is a field which is coming from my query which holds the serial number of the records.
My SQl Query
SELECT Row_Number() over(order by table_ID) AS Row_Count, Field_1,Field_2 from MyTable
In my Column group i have Customer Name and in my Row Group i have other details of the customer. The data is getting populated column wise but the issue is its not breaking the current row after three records.
Below is my table of report.

You were on the right track. Say you have data like this:
I have created a tablix like this:
The Row Group expression is:
=Ceiling(Fields!Row_Count.Value / 3)
This works together with the Column Group expression to split over three columns:
=(Fields!Row_Count.Value - 1) Mod 3
The other thing to note compared to your tablix is that CustomerName is not in a table header row, but rather there are two row header rows, one for CustomerName and one for Details.
This is looking OK to me, obviously you can format to taste:

Related

Create a cross reference table using Golden record and associate other records to the record

I have a table where I have ranked all the rows based on the created date column and have the rank indicated on the table as below
main table
I would like to create a cross-reference table with the golden record as the recurring column and the other two records as associated records as below.
output desired
I would like to know how I can achieve this using SQL.
I have tried creating a seperate table with all ID numbers (Rank = 1) and then joining it with the main table to get the ones with rank 1,2 and 3 associated with it. But it doesnt seem to work as I intend to.
output
I have not tested but something like this should work. You might want to add a name_id field.
select b.id_number,a.id_number
from table a
join table b on a.name=b.name
where b.rank=1

SSRS output side by side

Looking at how to output a certain way.
Right now this is how SSRS outputs my table:
Output1
This is how I would like the table to output:
My expected output
Use Matrix and define the field with ID (777xxx) in the column group
I replicated your Data into my local Report. First step you data is something like below
ID CITY PRIMARYORELEMENTARY
7777888 Houston,TX Elementary
7777889 Houston,TX Elementary
7777890 Mumbai,IN Primary
7777891 Delhi,IN Elementary
Now you could so in your SSRS something like below.
Insert and then matrix
After you have matrix then you see matrix as below. Then in column select ID
Now select Rows and then add row inside group below
Now select Primary Element and City in two rows 1 after another.
Once you follow all the steps, below is how you will get your Report

Getting top 20 rows and the rest in 21st row in an SSRS Matrix Report

I want top 20 rows from an SSRS Matrix report and rest of the rows should be aggregated in 21st row with the row name hard coded as “Others”.
I have created the SSRS Matrix Report with row grouping based on "Category_Name" and Column grouping based on "Creation_Time". Column Group "Creation_Time" is formatted to show date in "M/yyyy" format. I am aggregating the “Id_Number” as Count(Id_Number) for each grouping and I want top 20 records sorted by count(Id_Number) in highest to the lowest order or descending order.
I have set the visibility condition as showed in the image:
I have given the following expression for the row "Others"
=count(iif(RunningValue(Fields!Category_Name.Value,countdistinct,nothing)>20,Fields!Id_Number.Value,0)
But it didn't work. I got the error saying "Running functions cannot be specified as nested aggregates".
I have earlier tried using TOP N filter on SSRS Row grouping based on count(Id_Number) which gives Top 20 rows.But if we add the " group total" to the row grouping, it will give the total of all rows and not just the top 20 rows. The logic that I thought of was to subtract the total of top 20 rows from the total of all rows. But I am not able to get the total of top 20 rows.
I used basic sql query with 2 parameters, #Begin AND #End :
SELECT Category_Name, Id_Number, Creation_Date
FROM Tbl
WHERE Creation_Date BETWEEN #Begin AND #End
The desired output of this report is this:
I am getting everything as per the desired output except for the last row "Others".
Amend your sql select script to include the following:
CASE WHEN ROW_NUMBER() OVER (ORDER BY SUM(Id_Number)DESC) >20 then 'Top 20' else 'Others' End AS 'Type'
Then in your report add in another separate tablix that is filtered by "type" = "others"

SSRS HEADER CHANGE (Change column name)

I have the following table in which I have already calculated the 95 percentile in SQL SERVER 2012.I want to produce the report in SSRS 2008R2. But when I place [95th%ile] in SSRS table column, it change the header to [ID95th ile]. Is there a way I can change it to [95th%ile] as this is what is in the current excel report and I have been told not to change it to any other name
Below is sample data that I am using.
CREATE TABLE ##PerCent (month Varchar(10), Percentile INT)
INSERT INTO ##PerCent
VALUES
('Jan',153),
('Feb',171),
('Mar',141)
SELECT
month,
Percentile AS '95th%ile'
FROM ##PerCent
You cannot add a field which name starts with numbers or any character different to a letter.
However you can change the name in the tablix header if you are presenting the dataset in that component.
Let me know if this helps.

SQL Server Table Display Uncertainty

In my database in the datatable I found some uncertainty while viewing the table. Rows are not sorted according to the id. I saw some random behavior. I mean the entire table should be there according to the Id. But it is not.
The snap of the datatable is
Its not showing the entry as per the order it should be. I am selecting the top 11000 rows order by Id.
My query is
SELECT TOP 11000 [Id]
,[Date]
,[S11]
,[S12]
,[S13]
,[S14]
,[S15]
,[S21]
,[S22]
,[S23]
,[S24]
,[S25]
FROM [MCAS].[dbo].[MCASMonitoring_Rev1] ORDER By Id
Why it is showing like this ?

Resources