how to count data from a specific variable reporting services and management studio stored procedure
Hi I’m kind of new with management studio and reporting services, sorry for this newbies question in advance.
I’m trying to count a variable’s value each time its value changes. The flow is the following:
1st you pick a “from” date and a “to” date. From (i.e 1/5/2024) to (i.e 5/5/2024) on a report on reporting services.
2nd management studio runs a stored procedure that runs a few lines of code that brings into the report the values of every day of this variable till the “to” date. The output of all of this is a table with the variables’ values of every single day. I managed to do this with a “while from date <= to date” and addind a day in every iteration. In the end I put a select to bring the table’s values into reporting services.
Instead of this table I need this variable’s sum of values and not a column of values describing every day’s results. Can you help me out here? I’m getting
ROW 1 = 10
ROW 2 = 2
ROW 3 = 5
But I’d need it to say just 17! and not every single value.
set @IterDate=@FromDate
while @IterDate<=@ToDate
begin
INSERT into #MyTable exec My_Stored_Procedure @IterDate
set @IterDate=DATEADD(dd,1,@IterDate)
end
————————– Output ————————
select * from #MyTable
The idea would be to get only a cell’s result and not a column of results. Can you imagine something I can put in my second stored procedure to give me a final result instead of this column of values?
Thank you in advance!
Hi I’m kind of new with management studio and reporting services, sorry for this newbies question in advance. I’m trying to count a variable’s value each time its value changes. The flow is the following:1st you pick a “from” date and a “to” date. From (i.e 1/5/2024) to (i.e 5/5/2024) on a report on reporting services.2nd management studio runs a stored procedure that runs a few lines of code that brings into the report the values of every day of this variable till the “to” date. The output of all of this is a table with the variables’ values of every single day. I managed to do this with a “while from date <= to date” and addind a day in every iteration. In the end I put a select to bring the table’s values into reporting services. Instead of this table I need this variable’s sum of values and not a column of values describing every day’s results. Can you help me out here? I’m getting ROW 1 = 10ROW 2 = 2ROW 3 = 5 But I’d need it to say just 17! and not every single value. set @IterDate=@FromDatewhile @IterDate<=@ToDatebeginINSERT into #MyTable exec My_Stored_Procedure @IterDateset @IterDate=DATEADD(dd,1,@IterDate)end————————– Output ————————select * from #MyTable The idea would be to get only a cell’s result and not a column of results. Can you imagine something I can put in my second stored procedure to give me a final result instead of this column of values? Thank you in advance! Read More