Addition of 2 fields in SSRS report using HTML markup

Hi all.

I would like to add 2 numbers in an expression that uses "HTML - Interpret HTML tags as styles" as the Markup type. I've tried the following:

="<b>" + "Net Order: " + "</b>" + CDbl(First(Fields!NonTaxableAmount.Value, "DataSet1")) + CDbl(First(Fields!TaxableAmount.Value, "DataSet1"))

Open in new window


="<b>" + "Net Order: " + "</b>" + CDec(First(Fields!NonTaxableAmount.Value, "DataSet1")) + CDec(First(Fields!TaxableAmount.Value, "DataSet1"))

Open in new window

But it displays #Error when I preview the report.

Any idea how I can add these 2 fields? They are of type Decimal in the table.

Thank you in advance.
Who is Participating?
Arifhusen AnsariBusiness Intelligence Developer and AnalystCommented:

Try to convert decimal data in string too.

Because using "+" with String and decimal data and also use "&" rather than "+".


="<b>" & "Net Order: " & "</b>" & CSTR(CDec(First(Fields!NonTaxableAmount.Value, "DataSet1"))) & CSTR(CDec(First(Fields!TaxableAmount.Value, "DataSet1")))

Open in new window

To show your data in html format. You need to change text property. Select HTML

printmediaAuthor Commented:
Thank you Arifhusen! That was it. I tweaked it a little bit, I already had it set to HTML markup but adding the & and CDec to both fields made it work.

Here's how it looks now:

="<b>" & "Net Order: " & "</b>" & "$" & CSTR(Format(CDec(First(Fields!NonTaxableAmount.Value, "DataSet1"))+ CDec(First(Fields!TaxableAmount.Value, "DataSet1")),"F2"))
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.