how to solve SSRS Formatting issue? - reporting-services

Currently the data in field is coming like this 9646.88 and my requirement is
Remove decimal places and add comma for thousands e.g. 9,646
=IIF((RTRIM(Fields!COMPANY_NAME.Value))="VACANT","",Fields!BASE_RENT_PM.Value)
Please help, I am a newbie in SSRS.

Go to Properties pane when you select the textbox.
Then put this on Format property
#,0;(#,0)

Using Common Functions such as Text and Conversion functions shown in Expression window will give you the desired result.
For e.g,
Format(Int(9646.88), "#,###") // try "#,##0" which returns 0 if less than 1
where Int(9646.88) returns the integer portion of the number 9646 and Format(9646,"#,###") returns a string formatted according to instructions contained in a format String expression "#,###" which is a thousand seperator. Thus, it will give you "9,646".
So, in your case, try this,
=IIF(RTRIM(Fields!COMPANY_NAME.Value)="VACANT", "", Format(Int(Fields!BASE_RENT_PM.Value),"#,###"))
Note:
Format(9646.88, "#,###") will return a rounded result 9,647 and
Format("VACANT", "#,###") returns just "#,###",
none of which may not be your desired result.

Have your Tried this?
=FORMAT(IIF((RTRIM(Fields!COMPANY_NAME.Value))="VACANT","",Fields!BASE_RENT_PM.Value),"#,###")
Should solve your issue.
Kind Regards

To add comma for thousands, you need to change your expression.
If you need output as 9,646 then try below.
=IIF(RTRIM(Fields!COMPANY_NAME.Value)="VACANT","",Format(Convert.ToInt32(Int(Fields!BASE_RENT_PM.Value),"#,0;(#,0)")))
OR
=IIF(RTRIM(Fields!COMPANY_NAME.Value)="VACANT","",Format(CInt(Int(Fields!BASE_RENT_PM.Value),"#,0;(#,0)")))
Updated Answer:
As you want to handle null values as well I would suggest below way to achieve your goal.
Set Textbox visibility with below expression.
=IIF(ISNOTHING(Fields!BA‌​‌​‌​SE_RENT_PM.Value),True,False)
So if null value is there then it will show blank in the ssrs report.

Related

Replace Zero with Blank in SSRS

Is it possible to replace 0 with blank in ssrs matrix. The expression
=IIF(IsNothing(Count(Fields!referralNo.Value)),0,Count(Fields!referralNo.Value))
is same as
=Count(Fields!referralNo.Value).
When I try =IIF(IsNothing(Count(Fields!referralNo.Value)),'',Count(Fields!referralNo.Value)) I'm getting error. Can somebody pls help!
you could use text box properties and set show zero as: option to blank.
I use this expression for percentage data - I like code better than format, but they both work ;)
=iif(Fields!STUFF_PCT.Value>0,Fields!STUFF_PCT.Value,"")
Use this format #,##0.00;-#,##0.00;""

Hide SSRS chart based on multivalue parameter

Good Afternoon,
I have a multivalue parameter where if the last value in the array has the value "Reentry", it should always display the report. However, if the last value in the array is not "Reentry" it should hide the chart because it doesn't apply to the other choice. The choices are Corrections, Reentry and All. I applied the following expression to the visibility option of the target chart.
=IIf((Parameters!Division.Value(Parameters!Division.Count-1)="Reentry"), True, False)
This is showing the report for all cases, even when I select only Corrections which is the value that appears in a textbox where I placed this expression, being the last value in the array.
=Parameters!Division.Value(Parameters!Division.Count-1)
I have tried all kinds of other ways to get this to work and I have been stuck for a day. I think this approach is the easiest but it is always showing the chart, no matter what is selected. Any thoughts? This shouldn't be so difficult...thanks in advance!
Try using this expression:
=IIF(
Array.IndexOf(Parameters!Division.Value,"Reentry")=
Parameters!Division.Count-1,True,False
)
Let me know if this helps.

show/hide columns in SSRS report 2012 based on Multiselect parameter

i have been trying to hide/show columns within my tablix based on multi value parameter , but whenever i am plugging in the expression in the column visibility properties it is not showing what i select from the parameter and hide what is not select.
Here is the expression:
=IIF(InStr(JOIN(Parameters!parameter.Value,", "),"value"),false,true)
any help???
If I understand correctly, you want to show the column if you select a value which contains "value". Right?
So the expression should be like below:
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,false,true)
I always get this wrong too. I think backwards. It is actually asking for the expression that will hide the column. SO Black_T is correct with his answer.
=IIF(InStr(JOIN(Parameters!Parameter.Value,","),"value")>0,false, true)
so whenever the expression picks up that value in the statement, it will return false, meaning that it should not hide it, and whenever it doesn't find it, well the returned product will also hide it! pretty ingenious!
Thanks and enjoy!
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,true,false)

How to remove trailing zeros using ssrs?

I have a column DECIMAL(18,4). when I insert data like 123.45 it becomes 123.4500
I want to show it in SSRS like 123.45.
How to remove those zeros in SSRS?
Depending on what exporting formats your need you can set the number formatting to 0.####;(0.####)
I know this is compatible with the SSRS viewer and exporting to PDF, but Excel would take 123.0000 and show it as 123. instead of just 123
I dont agree with the accepted answer, casting to a string is another workaround:
=Str(NumericValueWithVariableDecimalPlaces)
Unfortunately a consequence is no numeric formatting settings will apply and setting cell Alignments to right causes numbers to be misaligned.
You can change the data type returned to SSRS to a FLOAT. That should do it :-)
Open SSRS Query Designer and add:
SELECT CONVERT(DOUBLE PERCISION,FIELD) FROM TABLE SOURCE
OR add to your select result from your Store Procedure source
SELECT CONVERT(DOUBLE PERCISION,FIELD) FROM TABLE SOURCE
This will remove trailing zeros: CDbl(Fields!YOURFIELD.Value)
This can be done in the SQL which you can do by casting the value to DECIMAL(18,2)
ex:
CAST(FieldName as DECIMAL(18,2))
but if you really want to do it in SSRS. You can right click on the textbox that the field is displaying in and go to textbox properties. In the pop-up box choose 'Number' and set the Category to 'Number' and then decimal places to 2. This should correctly display the value.
You could also right click on the textbox and go to expression and say this in the expression popup box:
=FormatNumber(Fields!FieldName.Value,2)
I try and find solution:
I use Expression for value:
=IIf(IsNothing(Fields!FieldName.Value), "", IIf(IsNothing(Fields!FieldName.Value), "-", CInt(Fields!FieldName.Value * 10000) / 10000))

SSRS custom number format

I am go to generate an excel file from SSRS, and
I want to format the number like this...
15 is displayed as 15
14.3453453 is displayed as 14.35
12.1 is displayed as 12.1
0 is displayed as 0
1 is displayed as 1
I can apply this in Excel but unable to apply in SSRS
[=0]0;[=1]1;0.##
Does anyone can suggest another way for me? Thanks!
am assuming that you want to know how to format numbers in SSRS
Just right click the TextBox on which you want to apply formatting, go to its expression.
suppose its expression is something like below
=Fields!myField.Value
then do this
=Format(Fields!myField.Value,"##.##")
or
=Format(Fields!myFields.Value,"00.00")
difference between the two is that former one would make 4 as 4 and later one would make 4 as 04.00
this should give you an idea.
also: you might have to convert your field into a numerical one. i.e.
=Format(CDbl(Fields!myFields.Value),"00.00")
so: 0 in format expression means, when no number is present, place a 0 there and # means when no number is present, leave it. Both of them works same when numbers are present
ie. 45.6567 would be 45.65 for both of them:
UPDATE :
if you want to apply variable formatting on the same column based on row values i.e.
you want myField to have no formatting when it has no decimal value but formatting with double precision when it has decimal then you can do it through logic. (though you should not be doing so)
Go to the appropriate textbox and go to its expression and do this:
=IIF((Fields!myField.Value - CInt(Fields!myField.Value)) > 0,
Format(Fields!myField.Value, "##.##"),Fields!myField.Value)
so basically you are using IIF(condition, true,false) operator of SSRS,
ur condition is to check whether the number has decimal value, if it has, you apply the formatting and if no, you let it as it is.
this should give you an idea, how to handle variable formatting.
Have you tried with the custom format "#,##0.##" ?
You can use
=Format(Fields!myField.Value,"F2")