SSRS Count on expression doesn't work on Matrix - reporting-services

I have setup a Matrix and use "Add total" to create a new column to show the total number in SSRS. Then I created another new column on the right with expression Replace the number in Add Total column with Text. However, when I use Count expression to count this new text column contain "Passed" and "Not Passed", it shows the total count without filtering. I have tried different expression, it shows either the total count or 0. I am getting confuse if I should be using =Count(Fields!xxx.Value = "Passed") OR =Count(Parameters!xxx.value = "Passed" ?
I have looked thru different example on this website but didn't seem to find a resolution, or it's the Matrix is created incorrectly ? Hope someone can provide some help. Million thanks.
Zoma

Related

Trouble creating nested SUM IIF expression in SSRS

I am new to SSRS and have a SUM(IIF question.
My data set contains four columns: Date, GroupID, PlanPaid, and NetworkIndicator.
Here is an example of the data set:
I am trying to SUM the [PlanPaid] amount when [NetworkIndicator] = "In Network".
However, I need this amount broken up by the [Date]. I tried accomplishing this by creating the expression:
=Sum(IIf(Fields!NetworkIndicator.Value = "In Network"
, Fields!PlanPaid.Value
, Nothing)
, "Claims_Rolling12")
But this expression returns the same amount (total) across all [Dates]. How do I break it up so that it is grouped by the correct [Date]?
Here is a photo of my Tablix and my current Groups: [Tablix and Groups]
And here is a photo of the output: [Output]
You haven't said where you want this sum to appear, so the answer here might not work. If it doesn't then edit your question to show what you expect the output to look like based on your sample data.
I'm assuming here that you want to add a new column to the report that shows "In Network total" by date.
The easiest way to do this is to add a row group that groups by date, then within this group you can use a simple expression, like the one you tried, but without specifying the scope.
=SUM(IIF(Fields!NetworkIndicator.Value = "In Network", Fields!PaidPlan.Value, Nothing))
This expression will only sum rows that are within the current scope, in this case the scope will be the row group you created to group by dates.
As IO said, if this is not helpful, edit your question and show what you expect your end result to look like, based on the sample data you supplied and then I can look at it again.

Apply filter to value returned within a table wizard report (Reportbuilder

looking for help or thoughts, Reportbuilder - I have a count value that has been generated from a count of a text field. Matrix report, count of PurOrd and count of PurIn. The report displays a numeric value rather than the actual text/word. I’m struggling to find or workout the expression required to use the count value to return whether “Yes” or “No”. If PurOrd (count value) = PurIn (count value) then “Yes” Else “No”.
Without more info, like where in the matrix this will appear and what your current count expressions look like I can't give an exact answer so you will have to adjust this to suit.
Basically you can just use an IIF() statement to compare you two current expressions, something like...
=IIF(Count(Fields!PurOrd.Value) = Count(Fields!PurInv.Value), "Yes", "No")
If this does not help, EDIT your question and add all relevant info such as screen shots o the report design, current expression being used etc.

Can I use WHERE clause in an SSRS expression?

I saw the post on WHERE clause in SSRS expression. I am also trying to do a where clause, but in a different way. I need to show ItemDesc when ItemId = 4. I set a parameter so that it will always equal 4 for this cell. Now I just need the matching description field. I cannot hard code it because the description may change one day. Is there a way to associate the two fields?
=IIF(Parameters!ItemID_4.Value = 4, Fields!ItemDesc.Value,"")
I am converting from Crystal Reports to SSRS. This first image is the output from CR. I only need to show that ItemDesc in that top left cell.
This next image is from SSRS. It is not limiting the descriptions. It seems to be doing what my expression is saying. ItemID = 4, so display all ItemDesc values but the two fields are not associated right now. I need it to only show the matching value.
Thank you for your help.
I cannot hard code it because the description may change one day.
You are hard coding the parameter anyway by trying to do it that way. I don't think you need a parameter to achieve the result unless you are restricted from adjusting the dataset query.
If you are using an embedded SQL query for your dataset, I would just put a filter in WHERE clause: WHERE ItemID = 4
Another way if you can't adjust the query is to go to Report Data view > Right click on the dataset for your table, "Dataset Properties" > go to the "Filters" tab and add a filter with these settings: Expression = ItemID, Operator = "=", Value = "4" (or "#ItemID" if you want to keep your parameter).

SSRS Total count error

I have a weird problem with SSRS and have studied countless Post/material for this unique problem with SSRS.
Need some clarification.
I have a matrix to calculate the total of employees who has done survey in dataset. In my database, for every question marked yes and no or likert scale question from (1 to4 values) so for each Question Qxx_A_1 ,we have N_Qxx_A_1 columns.
i.e As per the attachment, I am calculating the total of all the employees whose did the survey but if its value is less than 5, i need to hide it with "" (to maintain privacy) . Even if the "" has value like 1,2,3,4 so i need this value in total but it doesn't work.
For some condition this statement works well but for some condition it doesn't work well.
=IIF(IsNumeric(ReportItems!textbox4.Value) = 0, "*", Count(Fields!N_Q3_A_1.Value))
Can someone help me in writing custom code.
try using 0 instead of "*" in your formulas.
then just go into text box properties and set to display * instead of 0.

SSRS - I want to add a filtered expression for a calculation

--
I would like to add and expression that calculates a value based on a certain value. I have a dataset with the name DSSPend that has to columns one is the Area and the other spend. Now I would like to calculate the spend based on certain area values.
I tried something like this but does not seem to work
=Iif((Fields!Area.Value, "DSSSpend") IN ('New York','Miami','Texas') = SUM(Fields!Spend.Value, "DSSSpend"), 0)
=sum(iif((Fields!Area.Value = "New York" or Fields!Area.Value = "Miami" or Fields!Area.Value = "Texas"),
CDec(Fields!Spend.Value), CDec(0)))
There is no IN operator in SSRS expressions. You can achieve the same goal by using OR.
Also, your SUM aggregation needs to go outside the IIF. Your expression would evaluate the first record only rather than going through each record in the dataset and then aggregating. The expression I have written above goes through the entire dataset, summing either the value in the Spend field or 0, depending on the value of Area.
Update: If you were getting an error before, it was probably because it wasn't seeing your amounts as numbers. By converting them explicitly, you should get around this issue.