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


AND

="<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.
printmediaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Arifhusen AnsariBusiness Intelligence Developer and AnalystCommented:
Hello,

Try to convert decimal data in string too.

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

E.g.

="<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

Untitled.png
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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"))
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.