The SSRS CDec function is a Conversion function that will convert the given field or expression to a decimal. The syntax of the CDec function for converting to decimal values is as shown below.
CDec(Fields!Income.Value)
CDec(90.567)
To demonstrate the CDec function in reporting services, we use the Employee table below, which has 20 records. The image shows the records in the Table report.
SSRS CDec function Example
In an SQL database, the Order Quantity column is a Small int Data type, and both the Sales Amount and Yearly Income are Money data types.
For this, let me add a new column to the right side of the Orders column. Next, right-click the textbox under the CDec Ord and choose Expression to open the expression window below. The CDec expression below will convert the OrderQuantity column values to decimals.
=CDec(Fields!OrderQuantity.Value)
Similarly, let me create two more new columns to convert the SalesAmount and YearlyIncome values to decimals. The SSRS CDec function expressions for this are shown below.
=CDec(Fields!SalesAmount.Value)
=CDec(Fields!YearlyIncome.Value)
Please click the preview tab to see the CDec report.