SSRS Displaying Comma Delimited or Distinct Values in Single Column - reporting-services

I have a relationship like this:
I'd like to display the Acctnbr field in SSRS like this as a single field:
I have tried expressions like this
=Join(LookUpSet(Fields!Baseacctnbr.Value,
Fields!Baseacctnbr.Value,
Fields!Acctnbr.Value,
"DataSet1"), ",")
and I get an error message that reads:
Aggregate, Rownumber, runningvalue, previous and lookup functions cannot be used in calculated field expressions.
I can get the comma delimited field from SQL using the STUFF function, but my SSRS report is grouping and when I group I loose the SQL code.
How can I get this to work?
Much appreciated!

Using this dataset to test I recreated your scenario.
Try using your expression in a column of your tablix:
I've added the expression you posted in the cell is highlighted.
It will preview the following table.
Let me know if this can help you.

Related

How to use LIKE in tablix filtering with OR keyword in SSRS

I have a Table in my SSRS report and I want to filter the incoming data using a LIKE statement. The data looks like
CtrlNo OtherColumns
J-123 ...
K-2340 ...
R-3352 ...
What I want to show in the table is the data where CTRLNO starts with J- or R-. So I am going to "tablix properties", then the section "filters" and add my filter as below.
It works when I do not use the "OR" statement, but with "OR' it gives an error, see below.
I could not find the correct syntax for my filter. I've tried those below but no luck:
="R-"+"" OR "J-"+""
=(("R-"+"") OR ("J-"+""))
How can I use LIKE filter for a tablix with OR keyword? Any help would be appreciated.
Use this expression:
="[R,J]-*"
It shows all rows where the first character is R, or J and the second character is -.

Multiple datasets Count with IIF in SSRS

I am trying to write an expression in SSRS which counts only specific data using IIF. I found the following solution:
=Sum(IIF(Fields!Program.Value = "FC", Fields!QuantityToShip.Value, 0))
The code above works but only when there is ONE dataset, while I have several.
Here is the code I wrote:
=Count(IIF(Fields!Mgroup.Value,"DataSet1"=303,1,0))
I get the aggregation error:
Textbox refers directly to the field ‘Mgroup’ without specifying a dataset aggregate
I added a sum:
=Count(IIF(Sum(Fields!Mgroup.Value,"DataSet1")=303,1,0))
Still getting the same error.
Why is that?
What can I put instead of Sum? All I need is to count how many groups named 303 I have.
The expression you used has some sintax errors. The Count function only aggregate from the scoped Dataset.
Try this:
=LookupSet(303,Fields!Mgroup.Value,Fields!Mgroup.Value,"DataSet1").Length
Let me know if this helps you.

Date field filter is not working in Row Group level filter

I have added a Filter in Row Group-> Group Properties to perform sum of quantity only for those transactions which have done before a certain date.
Whenever I am selecting the 'Cdate' as Expression field from my dataset1, the type is showing as Date/Time but after saving it when I check,I found it as 'Text'. As a result the filter for 'cDate' is not working during report generation.
Note that, I can't filter the data in dataset side or tablix side as I have to show all the column items. This is a matrix report.
OK this is going to be a bit confusing because your dataset contains a field with the same name as one of the built-in expression functions ("CDate" - Convert to Date).
I sometimes run into these datatype issues when using filters and I find the best way to handle it is to force both the filter field and the filter value to be the same data type.
So in your case try setting the Filter expression to:
=CDate(Fields!CDate.Value)
then select the operator as "<=" and set the value using an expression as well:
=CDate(Parameters!MyParameter.value)
and see if that works.
I understand you so that your date field in the dataset is called CDate, try casting it as date, so instead of selecting it in your filter, type the following into the filter
=CDate(Fields!CDate.Value)

how do i make addition of two fields in ssrs expression?

I have generated one ssrs report
now i have two fields having values
1st field value is =Fields!FirstNO.Value
2nd field value is =Fields!SecondNO.Value
now i have one field average and i need to write expression like
average = (Fields!FirstNO.Value+Fields!SecondNO.Value) / (Fields!SecondNO.Value)
how can i write above in expression?? directly as i shown or any other syntax is there please help?
Are you sure these fields are numeric? Maybe try convert to numeric, like =cint(Fields!FirstNO.Value)

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).