Remove the blank entries in line graph SSRS - reporting-services

Hello as of now I have developed an SSRS report which is as below
As can be seen from graph, for the year 2018, the line drops to ZERO after 38/39 point but the data for that rows in NULL.
To remove that line, I have tried to set CustomAttributes to EmptyPoints=Zero, but that did not work.
The end result should be something like this, it should not display the data whose value is NULL
Can anyone help me on this?

How about you apply your filter at the graph to exclude records that have a NULL value for the column. The NULLS on the database can be matched against the column using the IsNothing() function in SSRS which returns a true if the record contains a NULL for the column field being passed.

Related

Hide Empty Zero Data Points in SSRS Line Chart

I have an SSRS line chart that I need to figure out how to hide empty data points - stop the line from making markers/continuing the line where Category Group values are zero:
The values and series and groups are setup as so:
With the data looking like this:
I have tried filtering both at the chart level and the Category Group levels to filter out data that would create groups for Series 2020 and Category October/November/December, this creating or filling those points in my mind:
Where the expression is "=DateSerial(YEAR(today()),MONTH(today()), 1)" achieving the net result of filtering out data points/rows that from an incomplete month - meaning when the report would be run on 10/10/2020, only data from before 10/1/2020 should be used to generate groups.
The problem is that you are using COUNT() which will always return a value, zero if there are no records to count.
I created a simple dataset and using count of FILE_NUMBER I got this (replicating your issue) ...
The easiest way round this is to change the value expression to something like this...
=SUM(IIF(Fields!FILE_NUMBER.Value = Nothing, 0, 1))
This way we add 1 to the sum for every non-empty value and nothing if it's empty. If the total sum is still empty, by default, the chart will not plot that point.
So we end up with this...

Brining row where column valus is null

I have a store procedure which brings the data as shown below . I'm new to SSRS reporting, I would like to show only those row where "email" column is null. How can i achieve it in SSRS ? As i mentioned I'm very new to this , any screenshot will help me a lot. Thank you for your time.
For this problem, you'll want to change the row visibility to hide rows with a value in that column. I assume you're using a table or matrix to layout this data. You'll want to right click on the row where your data fields are entered. Specifically, the grey box at the left of the row.
From there, you'll need to select the option to Show or hide based on an expression.
And finally, you'll need to enter an expression that finds the values in the email field. I'm not exactly sure what the field names are called but something like the following expression should do it.
= Not IsNothing(Fields!EmailField.Value)
This will check the field where you get the email value with a built-in function of IsNothing. Additionally, since you want fields that do not contain values, the Not keyword reverses the results. If the function evaluates to true and a value is present, the row will be hidden and vice versa.

Sum Values not equal to a space from a Control Source in MS Access

As the subject expresses, I'm trying to sum the values of a string field where spaces may exist. It must be done this way, unfortunately.
The database is very old. The original developer chose to make all fields Text fields; to get over the null value problems, a function was written in VB6 to replace any null value with a space. This cannot be changed.
Fast forward to now, I'm trying to create a report that sums the length field without changing spaces to nulls first, and it should be done entirely through the control source property of the report.
I've added some of what I've tried below, but every time the report is run, I receive:
Data Type Mismatch
...and I'm not sure how to get around it.
Ideally, I'd like to keep the users out of the database completely, and just add a combo box that lists the reports created in the database so they can be opened by name without having to run any additional update queries first.
=Sum(IIf([MY_LEN]<>" ",DCount("[MY_LEN]","MY_TABLE"),0))
=Sum(Nz(Iif(Trim([MY_LEN])='',Null,[MY_LEN]),0))
=DSum("[MY_LEN]","[MY_TABLE]","[MY_LEN]<>' '")
=Sum(Iif(Val([MY_LEN])>0,[MY_LEN],0))
=(SELECT Sum([MY_LEN]) AS MyLen FROM MY_TABLE WHERE (((MY_TABLE.[MY_LEN])<>' ')))
Is this possible?
Can't compare anything to Null. Can't say If x = Null Then because Null is undefined. So you can't test if undefined = undefined. Use If IsNull(x) Then in VBA and Is Null in query criteria. Don't really need IIf() for Sum() aggregate, other aggregates such as Count or Avg would.
To handle possible space, empty string, or Null for a text field holding numeric data.
=Sum(Val([MY_LEN] & ""))

How can I create an expression in an SSRS report similar to an Excel formula?

I need to combine the results of multiple similar Stored Procedures into a single Tablix.
I'm using multiple Stored Procedures that return the same data, but for varying Units. So in one "cell" (I don't know if that is the correct terminology for a data field in a Tablix) I have an Expression like so:
=IIF((Fields!Week.Value="WK1"),Fields!Price.Value,"")
...which conditionally displays data when the value of the "Week" field is "WK1" and the Stored Procedure for a Unit value of "BARNEY" is the dataset.
After that (on the same row, in a column to the right in the Tablix) I need to show the same data from a different Stored Procedure where the Unit value being used is "RUBBLE". I need the Expression to reference an existing value (ItemCode) in the Tablix from the first Stored Procedure, so that both cells on the row are displaying values for the same ItemCode (but different Units).
That cell/field is a simple pointer to the ItemCode value returned from the Stored Procedure:
=Fields!ItemCode.Value
How can I use a formula to display the data for the ItemCode that the initial Stored Procedure is displaying data for on that row. Something like this:
=IIF((Fields!Week.Value="WK1" AND Fields.ItemCode=[Existing Item Code value in this row]),Fields!Price.Value,"")
?
IOW, what do I need in place of the "Existing Item Code value in this row" to make this work? Could it be something like this:
=IIF((Fields!Week.Value="WK1" AND Fields.ItemCode=TextboxItemCodeData.Value),Fields!Price.Value,"")
?
If the main dataset for the tablix you are working in is BARNEY, then this is the basic lookup expression that you should start with to get data from the RUBBLE dataset.
=Lookup(Fields!ItemCode.Value, Fields!ItemCode.Value, Fields!Price.Value, "RUBBLE")
In this situation, the Price will be returned when the ItemCode values match between the BARNEY and RUBBLE datasets.
This is the expression that may help you hide or show a value from the secondary dataset.
=IIf(Lookup(Fields!ItemCode.Value, Fields!ItemCode.Value, Fields!Week.Value, "RUBBLE")="WK1", Lookup(Fields!ItemCode.Value, Fields!ItemCode.Value, Fields!Price.Value, "RUBBLE"), "")
The first part of the IIf is checking the Week field in the RUBBLE dataset. If the value is WK1, then it displays the Price from the RUBBLE dataset; otherwise nothing.
This might work if you don't have to check the Week value in the RUBBLE data, and just checking in the BARNEY dataset will work.
=IIf((Fields!Week.Value="WK1"),Lookup(Fields!ItemCode.Value, Fields!ItemCode.Value, Fields!Price.Value, "RUBBLE"),"")

SSRS: Get values from a particular row of DataSet?

My dataset currently has 12 rows of data. Each representing data for a month. I would like to have variance of a column between to rows, the rows being last & last but one i.e., latest month and previous month's data.
It could have been simple if I were to work on tablix but thats not the case. I want those values for a textbox.
Any ideas on it anyone?
I hope you are using SSRS 2008R2:
R2 introduced the Lookup function that is perfect for this scenario.
=Lookup( Fields!ProductUID.Value ,Fields!ProductID.Value,Fields!Price.Value,"PriceDataSet")
The Lookup function above will evaluate the first parameter ("Fields!ProductUID.Value") in the current dataset, then look for a matching value in the field specified in the second parameter ("Fields!ProductID.Value") in the dataset specified in the fourth parameter. The value of the third parameter is then evaluated in that row of the dataset and returned.
A little convoluted, but very helpful.
In your case, you can use this in a textbox with a calculated a static number:
=Lookup(
Month(DateAdd(DateInterval.Month, -1, GetDate())),
Fields!MonthID.Value,
Fields!Name.Value,
"DataSet1")
This should calculate a number for last month, then look for a match in DataSet1.
In this example I have a tablix with Statecode and name as below
enter image description here
Suppose you want to display the name of state of CA, write an expression as -
=Lookup(
"CA" ,
Fields!StateCode.Value,
Fields!StateName.Value,
"ReportData"
)
This will return 'California' in the text box
I ran across this post while trying to solve a similar problem but with columns of double data type. Not sure why but SSRS did not want to return my first row using LOOKUP in combination with ROW_NUMBER in SQL(If someone can solve that all the better). I ended up using a SUM(IIF) instead. Hopefully, this is useful for someone else.
=Sum(IIF(Fields!RowNum.Value=1,CDBL(Fields!MyNumericColumn.Value),CDBL(0)))
Note: If SSRS complains about data types, just cast both parts of the IIF to the desired data type.