HI ALL
i AM A BEGINNER IN SSRS AND I HAVE CREATED A RDL FILE IN WHICH I HAVE DISPLAYED THE DATA AS PER REQUIREMENT BUT PROBLEM IS OCCURING WHEN DATE CHANGES..
IN REPORT THERE IS PARAMETERS STATE,DISTRICT,@FROMDATE,@TODATE,COMMODITY NAME,SCHEME NAME WHERE MULTIPLE SELECTION IS ALLOWED IN THESE PARAMETERS.
I WANT TO SEE THE DETAILS OF THE COMMODITIES ;SCHEMEWISE. MEANS OPENING BALANCE,PROFIT,LOSS AND CLOSING BALANCE OF THE SELECTED COMMODITIES AND SCHEMES. I WANT ,WHEN DATE CHANGES THE CLOSING BALANCE OF THE SAME SCHEME WILL BE THE OPENING BALANCE IN FURTHER DATE.BUT IT IS NOT SHOWING THE PREVIOUS DATE CLOSING BALANCE..INSTEAD IT IS SHOWING THE INITIAL VALUE FROM THAT DATE..SO CAN ANY BODY HELP ME TO RESOLVE THIS PROBLEM.I WILL BE VERY THANKFUL FOR THIS..PLEASE HELP IF ANYONE CAN.

Amira BedhiafiRank #601 · 4K reputationPosted Mar 23, 2025, 6:06 PM EDT
Your dataset or query might not be carrying forward the previous day's closing balance when the report date changes. If your SQL query just pulls daily data, it doesn’t know what happened before
@FromDate.So the report always starts fresh from @FromDate, instead of continuing from where the balance left off.
You need to calculate and include the opening balance before
@FromDate, then use a running total logic to track balances.-- First, get opening balance before the report start date SELECT State, District, CommodityName, SchemeName, SUM(ClosingBalance) AS OpeningBalance FROM YourTable WHERE TransactionDate < @FromDate AND State IN (@State) AND District IN (@District) AND CommodityName IN (@CommodityName) AND SchemeName IN (@SchemeName) GROUP BY State, District, CommodityName, SchemeNameThen UNION it with the main data between
@FromDateand@ToDate:-- Then get transactions within selected date range SELECT State, District, CommodityName, SchemeName, TransactionDate, OpeningBalance, Profit, Loss, (OpeningBalance + Profit - Loss) AS ClosingBalance FROM YourTable WHERE TransactionDate BETWEEN @FromDate AND @ToDate AND State IN (@State) AND District IN (@District) AND CommodityName IN (@CommodityName) AND SchemeName IN (@SchemeName)If you cannot modify the query or want to calculate balances in SSRS, you can use RunningValue in the report:
=RunningValue(Fields!Profit.Value - Fields!Loss.Value, Sum, "DataSet1") + First(Fields!OpeningBalance.Value, "DataSet1")