SSRS missing values in tablix - reporting-services

SSRS (both 2008 and 2016 are doing the same thing) is not showing values. I have a column "Status" with three different possible values. Every row is populated in the result set of my query in SSMS. But in the SSRS tablix, more than half of the rows are blank.

If you have a 'group by' in your sql query, try removing it or change the order. Make sure it is in the right order of grouping. For example in my query, I had the following grouping
Group by Year, Measures, ProgramID, Program
This was giving me the same issue because the right order for the data was
Group by Year, ProgramID, Program, Measures

Related

ssrs 2008 r2 sort on a group displayed in a tablix

In an existing SSRS 2008 r2 report, I am trying to determine how to change the sort order of a grouping called termName in a tablix. The school terms are sorted in descending order. The termName column is defined as varchar(10), not null .
The values for termName are the following:
T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11, and T12.
The problem is the term names end up not have T12 sorted first followed by T11 then followed by T10 then followed by T9.
The sort ends displaying the terms incorrectly in the following order:
T9,T8,T7,T6,T5,T4,T3,T2,T1,T12,T11,and then T10.
Could I possibly use IIF expressions on the sort and/or on the location in the SSRS 2008 r2 report where the value is dispalyed? If so, can you show me what I can do?
Thus can you tell me what I can do sort on the tablix?.
=iif(Fields!termName.Value=”T12”,”1″,
iif(Fields!termName.Value=”T11”,”2″,
iif(Fields!termName.Value=”T10”,”3″,
””)))
etc, adding a line for all the terms
Just add to the group sort expression

Count calculated Column in SSRS

I have SSRS report where in I am using table with 7 columns (Date, Job ID, Job Name, Status, Output Count, Expected Count, Flag). Out of 7 columns , 4 are directly coming from dataset. Rest three (Job Name, Expected Count, Flag) are calculated columns. I am getting their values from either SSRS custom code or expression. I want to count those rows where Output Count and Expected Count are not matching. Also I have Flag column where I am using Background Color property to check if values are matching or not. So even if I can get count of rows having Red background at Flag column will also server my purpose. Please help me in achieving the same.
You can create some new fields for your dataset to handle calculated values. Then, in your report, you can add some groups and add count or sum values on the table.

SSRS Group Expression on a Column that may have a null value

I have an SSRS report that I am doing dynamic grouping on that displays an agenda with time. grouping performed on a field called subheader and then the agenda times (another field) displayed under that group subheader.
The problem that I am having is that I want to avoid the grouping if the parameter is null. I just want to sort by the time if there is nothing in the sub header group. Times are being displayed in the wrong order for the titles where the subheader field is null
Without seeing your report, I can't tell how your grouping works.
If grouping the NULLs won't affect the report, you can use ISNOTHING to group the records with the NULL value together. Then sort by the same group field then your time field.
=IIF(ISNOTHING(FIELDS!Subheader.Value), "", FIELDS!Subheader.Value)
But if you want them separate, group by a unique ID (if you have one in the data) or a random number to keep the blanks separated:
=IIF(ISNOTHING(FIELDS!Subheader.Value), CEILING(RND()*100000), FIELDS!Subheader.Value)
Sort by the same IIF expression used in the Group By field then sort by Agenda_Time.

Error in finding sum of a group and Conditional Summing in SSRS Reports

I have an SSRS Report, in the database there is a column by name Total_running_hours.
There are more than one record for a single Cycle_number like more than 1 row with same Cycle_number but different Block_numbers and the value in Total_running_hours field will be same for all the rows with same Cycle_number. Eg. 1 Cycle number with 4 diff block_numbers contain same Total_running_hours for all 4 rows.
Now the problem is, in the group footer if I put this field then it will show the Total_running_hours value only once which is correct, but my final requirement is,
I need to get the sum of this field in the Report footer which need to display the sum group wise. No matter how many rows are there for a single Cycle_number it has to take only once and display the result.
I tried in different ways like
=sum(ReportItems!textbox204.Value) // name of text box in Group footer
Error: Report item expressions can only refer to other report items
within the same grouping scope or a containing grouping scope.
=sum(Fields!total_running_hours.Value,Group_name)
Error: The scope parameter must be set to a string constant that is
equal to either the name of a containing group, the name of a
containing data region, or the name of a data set.
Can any one please help me in getting the sum Group wise
Thank you in advance.
I found solution for this Problem.
We cannot simply sum the Total_Running_hours value as this would give us duplicates and the incorrect answer. We cannot sum the reporting services group as it goes out of scope
There is no SUM DISTINCT available in Reporting Services 2005 so we can't get the distinct value that way.
Since the query may not return a particular Cycle_Number Type we cannot use that as a filter.
The solution found was to add a column of the row number within a windowed set partitioned by the Cycle_Number like this
ROW_NUMBER() OVER (PARTITION BY Cycle_Number ORDER BY Cycle_Number ) AS 'RowNumber'
Then in the reports’ footer total column we put an expression that only takes the first row’s value to sum and converts all other rows to zero in that windowed set.
=SUM(IIF(Fields!RowNumber.Value=1,Fields!Total_Running_hours.Value,0))
After using this if u found any error in textbox like #Error
Then try this
=SUM(IIF(Fields!RowNumber.Value=1,CDbl(Fields!Total_Running_hours.Value),CDbl(0.0)))

Retrieve Row Count on SSRS / MySQL

I'm using SSRS linked to MySQL by ODBC. My query sums the payment amount by customer, and sorts by amount desc. I want to use this to create a LeaderBoard in SSRS, showing the Rank, and only including the top 10 customers.
Option 1:
Do an additional query on my group query in SQL, adding the Row Number.
Option 2:
Add a calculated field in SSRS.
Option 1 seemed bulky, so started with Option 2; I added a calculated field to the dataset called "Rank", defined as =RowNumber("DataSet1")
I added a calculated field to the dataset called "Rank", defined as: =RowNumber("DataSet1")
But I got the following error:
The expression used for the calculated field 'Rank' includes an aggregate, RowNumber, RunningValue, Previous or lookup function. Aggregate, RowNumber, RunningValue, Previous and lookup functions cannot be used in calculated field expressions.
So, I then added it to the actual tablix, and I was able to get the Rank to show correctly.
(When I did this, it automatically added an extra column to my dataset.
I then wanted to filter the top 10 customers.
I first tried by "bottom 10" on this new field, but it didn't work. (Seems this field is all zeros in the actual dataset.)
I then tried by "top 10" on the payment amount, but received an error that the filter only supports Integers.
So I tried to convert the payment amount to Integer in MySQL, using CAST and Convert, but they don't support conversion to Integer, and SSRS didn't like 'SIGNED' or any of the other options.
I then started trying Option 1, which was building the query into MySQL.
I added:
SET #rank=0;
SELECT #rank:=#rank+1 AS Rank, ...
This works in MySQL, but I get an error when I paste that query into the report definition on SSRS.
Any ideas?
Rather than setting #rank=0 in a separate statement, try setting it in a subquery cross-joined to the main query - like so:
SELECT #rank:=#rank+1 AS Rank, ...
FROM (SELECT #rank:= 0) r
CROSS JOIN ...