Quantcast
Channel: SQL Server Reporting Services
Viewing all articles
Browse latest Browse all 1418

RDLC report to show total of a column

$
0
0

Hi,

I have an RDLC report(tabular) and I need to show the total of a column named Total in my report. My code to fetch data is:

protected void btnCreateReport_Click(object sender, EventArgs e)
        {
            try
            {
                ReportViewer1.Visible = true;
                string FromSite = DropDownList1.SelectedItem.Text.ToString();
                string FromDate = txtSelectDate1.Text;
                string ToDate = txtSelectDate2.Text;
                string query = "select Dump_Date as Date,Dump_Num as DumpNum,ItemID,SiteID,Qty,Cost,cast(SUM(CAST(Qty as decimal(14,4))*cast(Cost as decimal(14,4))) as decimal(14,2)) As Total from IC_Dump_T where SiteID = '" + FromSite + "' and Dump_Date between '" + FromDate + "' and '" + ToDate + "' group by Dump_Date,ItemID,SiteID,Dump_Num,Qty,Cost";
                ReportViewer1.ProcessingMode = ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/DumpReport.rdlc");
                RptDump dsdump = GetData(query);
                ReportDataSource datasource = new ReportDataSource("RptDump", dsdump.Tables[0]);
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(datasource);
            }
            catch (Exception ex)
            {
                lblMessage.CssClass = "alert alert-warning";
                lblMessage.Text = "Msg 014: Please choose a valid date range";
            }
        }

Now, I need to show the total of Total column. I have tried the expression:

=Sum(Fields!Total.Value)

but I have got a blank row but not the total of the column. Please help me show the sum for this report. My Column has decimal values in it and I need the total to show decimal values as well.

Thanks,

Deepak
 


Viewing all articles
Browse latest Browse all 1418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>