SSRS Filter with a different column from a different dataset - reporting-services

I want to filter my column, let's call it AllStudentID from dataset1 with another column from a different datset.
Dataset1 had many column such as AllStudentID, Class, Time, Location.
Dataset2 has other columns but i'm focused on a similar column called OnCampusID.
I've tried looking into using a filter but since the report itself has the columns from Dataset1, i run into an issue where if I select the column in dataset2, it always gives a First(OnCampusID). And I don't want that.
I looked into IIF() but again, i'm using a column from a different datset plus if let's say that they are NOT equal, I don't want to display anything, instead of putting something there. I know that you have to put a result if true and a result if false.
If I"m thinking of it in terms of SQL statements, it's like having a WHERE clause WHERE AllStudentID=OnCampusID.
I tried running a Parameter but I don't want the select part on the top but rather have the report filtered already.
Am I missing something? I know it has to be simple.
Mind you, the following example above is just an example i made up, not the real thing.

Assuming that each OnCampusID only appears once in Dataset2 then you can do a Lookup expression to filter it:
=IIF(IsNothing(Lookup(Fields!AllStudentID.Value, Fields!OnCampusID.Value, Fields!OnCampusID.Value, "Dataset2")), False, True)
If OnCampusID appears more than once in Dataset2 then do the same thing using LookupSet.
To get the graduate field from Dataset2 just to a Lookup in the Value of the cell, like so:
=Lookup(Fields!AllStudentID.Value, Fields!OnCampusID.Value, Fields!Graduate.Value, "Dataset2")

Related

SSRS lookup missing dataset

I have a dataset which looks like this
Name Spend
"First Aid" 2
"Healing Arts" 0
"Surgeon" NULL
I then have three separate textboxes which will be filled with the value of the column which matches the name.
Example: show value of spend in textbox if value of name equals First Aid
for this I've made following expression
=Lookup(Fields!skill_name.Value, "First Aid", Fields!skill_spend.Value, "Skills")
My problem is however that I get an error saying that skill_name is missing its dataset, which doesn't make sense to me as it is informed in the end of the expression (skills)
I think you may be misunderstanding the purpose of Lookup and how it is used. The purpose of the Lookup function is akin to a JOIN in SQL in some ways. Basically, you would have two datasets that each have a matching field with the other. In that scenario, the expression would match on the skill_name field and lookup the skill_spend value and the expression would look something like the following.
=Lookup(Fields!skill_name.Value, Fields!skill_name.Value, Fields!skill_spend.Value, "Skills")
As the documentation shows, the first reference to skill_name is the field you are referencing from the current dataset. The second reference is to the dataset from which you are attempting to look up a value. The third expression is the field you are looking up and the dataset should be the one you are attempting to look up a value from, not the current dataset scope.
Lookup(source_expression, destination_expression, result_expression, dataset)
From the best I can tell, you have a single dataset but separate textboxes that need the correct spend value. I think the following expression will work.
= IIF(Fields!skill_name.Value = "First Aid", Fields!skill_spend.Value, Nothing)
This expression should get the skill_spend value associated with the row "First Aid" only and leave the textbox blank otherwise.

In SSRS, how to include first row from different dataset in tablix?

I am creating a report, the purpose of which is to print a letter to many different people. Obviously each person's name, email, etc. will be different. For this I am using a list, which I understand uses a tablix.
Now inside each letter I also need some global data that comes from a dataset. For example, the company email, telephone number, etc. This data will be the same for every letter. However, every time I try to use some expression to get this, I get an error such as:
The Value expression for the text box ‘Textbox11’ refers to the
field ‘URL’. Report item expressions can only refer to fields within
the current dataset scope or, if inside an aggregate, the specified
dataset scope. Letters in the names of fields must use the correct
case.
The expression I'm using to get the above error is
=LookupSet(true, true, Fields!URL, "SystemVars")
I've tried other things but I can't figure out what I need to make it word.
Is there an expression I can use to solve this problem? If not, what steps should I take to get my letters working?
You are missing the ".Value" portion in the expression. Try this:
=First(Fields!URL.Value, "SystemVars")

How to apply multiparameter to ssrs report filter

I have a master that can be filtered using 4 different parameters. I used a iif statement to join all the parameters to filter the report.
The problem I am now having is when more than one paramater is selected, it tends to return values for the first parameter rather than for all
My paramter expression is as follows:
expression
iif(IsNothing(Parameters!Div.Value)=0,Parameters!Div.Value
,iif(isnothing(Parameters!St.Value)=0,Parameters!St.Value
,iif(isnothing(Parameters!Sp.Value)=0,Parameters!Sp.Value
,Parameters!Hc.Value)))
values
=iif(IsNothing(Parameters!Div.Value)=0,Parameters!Div.Value
,iif(isnothing(Parameters!St.Value)=0,Parameters!St.Value
,iif(isnothing(Parameters!Sp.Value)=0,Parameters!Sp.Value
,Parameters!Hc.Value)))
Any help will be helpful
I think what you are trying to do is something like this:
=IIF(NOT ISNOTHING(Parameters!Div.Value), Parameters!Div.Value,
IIF(NOT ISNOTHING(Parameters!St.Value), Parameters!St.Value,
IIF(NOT ISNOTHING(Parameters!Sp.Value), Parameters!Sp.Value,
Parameters!Hc.Value)))
Do you only want to check for one value?
I usually check each parameter separately so it uses all of them at once. Though there may be a situation where your theory is what you want.
If you want to evaluate all the parameters, just add them to the FILTER of the dataset, table, or group. Choose your field in the Expression and the Parameter in the Value.

LookUp not matching properly

So, I have a problem in Report Builder that is just driving me absolutely crazy.
I have two dataset; one called DS_Grades and the other DS_Pupils. I want to do a simple LookUp based on PupilID, a field that is in both datasets, and return a grade from DS_Grades into a Matrix based on DS_Pupils.
The formula I am using is:
=LookUp(Fields!PupilID.Value, Fields!PupilID.Value, Fields!Grade.Value, "DS_Grades")
I have confirmed that:
1) DS_Grades has the right PupilIds
2) There are actually values in the Grades field
3) Both PupilID fields (I.E. in both datasets) are definitely Integers and not text.
Moreover, if I add a calculated field to DS_Grades called "test" and populated with the value 208301, which is a valid PupilID, then I can enter the below formula and it works fine:
=LookUp(208301, Fields!test.Value, Fields!Grade.Value, "DS_Grades")
So, the LookUp itself must be matching properly, which means that the PupilID fields must be causing the problem, but I have quintuple freaking checked them and they definitely have the right values, in the right format. I am at a total loss as to why SSRS thinks that they don't match.
Help please!
Got it! Some filtering was at Dataset Level (instead of query where I normally do it) that was throwing the whole thing out of joint. Removed that, and it's fine.

stuck in microsoft report

My report is containing some null value.
Report is generated through query
In my report I am calculating sum of every field for that I had written =iif((field name) is null,0,sum(field name))
Through this function I am getting result as 0 only if field contains some value as well
I agree with Remou, you should be using the footers for totals. However if you wanted to carry on with the way you are doing things then try replacing the IIF with NZ(MyField,0)
You should put that IIf statement in the query for that (or those) fields that you want to avoid nulls on. That way you can just put the Sum function in the details section of the report with impunity (assuming details section here).