Reporting Services :: Default Previous Week Sunday
Aug 1, 2015Is it possible to show previous week Sunday date as default in Date Parameter in Reports.
View 2 RepliesIs it possible to show previous week Sunday date as default in Date Parameter in Reports.
View 2 RepliesI would like the following code to display Sunday of the Week Sunday to Saturday.
print DATEADD(WEEK, DATEDIFF(WEEK, 0, '2015-10-18'), 0)
If I input a date between '2015-10-18' and '2015-10-24' I would like to print '2015-10-18 as well
hi friends,
how to get the date of the first/last day of the week in sql...
can any one help me
Cheers,
raj
Hi Guys,
Can you please help me on how to find the sunday's date of a certain week?
Eg: I want to find the date of the sunday of certain week.
We are trying to compare our current calendar week (based on Monday being the first day of the week) with the previous calendar week.
I'm trying to produce a line chart with 2 axis:
- x axis; the day of the week (Mon, Tues, Wed etc - it is fine for this to be a # rather than text e.g. 1 = Mon, 2 = Tues etc)
- y axis; the cumulative number of orders
The chart needs two series:
Previous Week. The running count of orders placed that week.
Current Week. The running count of orders placed this week.
Obviously in such a chart the 'Current Week' series is going not going to have values along the whole axis until the end of the week. This is expected and the aim of the chart is to see the current week compares against the previous week for the same day.
I have two tables:
Orders TableCalendar Table
The calendar table's main date column is [calDate] and there are columns for the usual [calWeekNum], [calMonth] etc.
My measure for counting orders is simply; # Orders: = countrows[orders].
How do I take this measure and then work out my two series. I have tried numerous things such as adapting TOTALMTD(), following articles such as these:
- [URL] ...
- [URL] ...
But I have had no luck. The standard cumulative formulas do work e.g. if I wanted a MTD or YTD table I would be ok, it's just adjusting to a WTD that is causing me big issues.
I need to generate the week ranges like this format :
Here from date and to date would be picked up from the table but just to make you understand i have hard coded it but this is the real date which is falling inside the table.
Note : Week should be generated from Monday to Sunday within desired date range
I'm quite a newbie with MDX.
I have a report that uses MDX to return Figures by day. The user selects the Month/Year eg.[Nov F2007] that he wants to see the figures for.
Here is the catch:
The user wants the figures to cut off to the previous Sunday. So if its Thursday, the result set will still only return results to Sunday.
What I'm thinking is something like this:
STRTOMEMBER('[Nov F2007]').FirstChild : STRTOMEMBER('[Nov F2007]').[LastSunday].
I'm not sure if I'm on the right track, but its a mute point if I can't get the previous sunday as a normal day member (ie. 4 November 2007)
Thanks,
Jason
I have a report which display
Group value col1 Per %
1 188
2 109 109/188 = 58%
3 48 48/109 = 26%
I know we can do it using lead and Lag in SQL but i have complex agregates in sql so, i have to do it in ssrs report. How can I do this in ssrs ?
I have a report like the above, I want to, for example to find the total of all stores, i.e
(8+10+14+4+2 =38),
then use column #SALONS AUDITED to calculate the last total, e.g.
%AUDITED dean : 4/38
= 10.53%; lani : 5/38 = 13.16%; vette : 7/38 = 18.42%, etc
I'm using Server 2012 R 2 with SQL Server 2012 Reporting Configuration Manager 11.0.5343.0 . The default time values (pTimeframe) for generating the report of my DPM Summary are the default values Day - Week - Month.
How can I define the value "Last 24 hours" for example?! Because the DPM Server does it backups the whole night starting at 08:00pm the day before and the result of the finished Backups of yesterday won't be shown when I use the defaut value "Day".
I want to send a subscription every morning for the backups only of the night before (not the whole week).
I changed my laptop name from DELL-5 to KHALEDPC..I have SQL Server 2014 Express Edition with Advanced Services installed.every thing went well for reporting services and connecting to the server but I noticed that the Securables list for my Login still displaying the old server name?
View 5 Replies View RelatedI need a report that shows calcul of a field for current year as well as previous year respecting this rule expression(Last-Last Previous)/Last Previous*100 (I work with MDX Query and i work with SSRS 2008).
Also the report runs on a Year Parameter. Below is an example for the result for example i selected the years 2010 2011 2012 i can select another years because i have the report runs on a Year Parameter
year
Data 2010 2011 2012
hp 14 25 30
Dell 17 18 20
and the result i want
year
Data 2010 2011 2012 2011/2012
hp 14 25 30 0.002 (Last -Last Previous)/(last Previous*100) =(30-25)/(25*100)
Dell 17 18 20 0.0040
I have a simple report that looks like this:
January February March April
Sales 1050 800 750 1100
Units Sold 50 40 41 60
I want to change the background color to yellow if the value is less than the previous month. For example for the sales row, February sales is less than January and March sales is less than February so I would want the values (800 and 750) to have a background color of yellow. The columns is grouped by month.I've tried experimenting with the Previous function but I run into the following error message: The BackgroundColor expression for the text box has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset.
We have a need to report on historical data when none exists in the database.
Create a tabular report rdl that is run on a regular schedule. This report run is saved as an Excel sheet that overwrites the previous run, which has the same name.
Report is designed to use two data sources--the database and and the previously run Excel sheet. The data is "merged" using the Lookup function thereby creating a new report that includes the history needed.
I have a ssrs report which has a parameter start date.i have made 12 columns acc to client req which i cannot change:
jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec
These columns are dynamic acc to start date for which i have used this exp for first cell:
=monthname(month(Parameters!Startdate.Value),true) and for next 11 cells accordingly.
These 12 columns are grouped quaterly which i have made statically again for clien req which i cannot change so they are grouped staticaly by me in report like:
q12015 |q2 2015 |q32015 |q42015
jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec
exp for quarterly is :
="Q" & DatePart(DateInterval.Quarter, Parameters!Startdate.Value) & year(Parameters!Startdate.Value).
Now when i select my start date of months jan,apr,july and oct report work fine.... but when i select my start date months of feb,may,aug and nov then reportis something like: (lets say i choose feb)
q12015 |q22015 |q32015 |q42015
feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|jan.
What is happening is in q1 feb,mar and apr are coming and what i want in q1 is jan,feb and mar.
And in q4 nov ,dec and jan is coming and what is want in q4 is oct,nov and dec.
So generally what is am asking is how to display jan in this condition in my first cell.same apllies for rest of months..
Similarly when i select my start date months of mar,june,sep,dec i want previous two months to be displayed.
I'm trying to creating the following matrix in SSRS 2008R2 (with more product categories than shown here)The matrix only shows the last two year per product.
The matrix in the report builder looks like this:
For me it's unclear what the expression should be. (or perhaps I need to make a calculation in my TSQL?)
As Row Groups in the matrix I've got:
Product; Year
As Column Groups i've got Month
I can't get it to work. Previous doesn't seem to work in this case (only when I got a total of each year (e.g. one column instead of 12))
I have a requirement to show Day of week in parameter drop down list in different order, actual order is Monday to Sunday (Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday) in DayOfWeek dimension in cube.
But my requirement is to show Friday to Thursday(Friday,Saturday,Sunday,Monday,Tuesday,Wednesday,Thursday) in DayOf Week parameter drop down list and report table. How I can get this requirement done.
How do i get only the records for everything with only the dates from last week (monday-friday)? I want to have this run every week for the previous week. Here's my stored procudure. Right now i have this to run for the day before, but now i need it for the week before. So its a range. Please Help. Thanks!
Code Snippet
CREATE PROCEDURE [dbo].[Testing_Out_Of_Stock_SKUS_WEEKLY]
(@Classification varchar(50))
AS
BEGIN
SELECT RC_STAT.dbo.Brand_Dimension.Report_Level,
RC_STAT.dbo.Brand_Dimension.[Cat vs Dog],
RC_STAT.dbo.Brand_Dimension.Item_Merged,
Qry_Sales_Group.Region_Key,
Qry_Sales_Group.Region,
Qry_Out_Of_Stock.product_structure_level,
Qry_Out_Of_Stock.product_entity_code,
Qry_Out_Of_Stock.cycle_day,
Qry_Out_Of_Stock.customer_code,
Qry_Out_Of_Stock.description,
Qry_Sales_Group.Code,
Qry_Sales_Group.SR_Name,
Qry_Sales_Group.Name AS Territory_Name,
Qry_Out_Of_Stock.Store_Name,
Qry_Out_Of_Stock.time_log,
Qry_Out_Of_Stock.out_of_stock,
Period_Code
FROM RC_STAT.dbo.Brand_Dimension INNER JOIN
dbo.Qry_Out_Of_Stock ON
RC_STAT.dbo.Brand_Dimension.Item_Key = dbo.Qry_Out_Of_Stock.product_entity_code COLLATE SQL_Latin1_General_CP1_CI_AS INNER JOIN
dbo.Qry_Sales_Group ON
dbo.Qry_Out_Of_Stock.sales_person_code = dbo.Qry_Sales_Group.SalesPerson_Purchaser_Code COLLATE Latin1_General_CI_AS
Where Classification=@Classification DateDiff(dd,0,dbo.Qry_Out_Of_Stock.time_log) =
case
when Datepart(Weekday, Getdate()) = 2 then datediff(dd,0,GetDate()) - 3
else datediff(dd,0,GetDate()) - 1
end
END
SET NOCOUNT OFF
I have written a piece of SQL which I thought was wokring fine. I wanted to show all data for the current week from Monday - Sunday
I wanted to pick up all data from Monday 00:00:01 to Sunday 23:59:59 and then when the data runs again on the next Monday, a completley new set of data starts to be loaded in
On the off chance I have come into work today and realise that no data is being diaplyed, and today is a Sunday
I know for a fact that my SQL will pick up data as soon as it hits 00:00:01 tonight
I really want my SQL to pick up data for a Sunday
BETWEEN DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0) AND DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 6)
I have a table with score info for each group, and the table also contains historical data, I need to get the ranking for the current week and previous week, here is what I did and the result is apparently wrong:
select CurRank = row_number() OVER (ORDER BY cr.CurScore desc) , cr.group_name,cr.CurScore
, lastWeek.PreRank, lastWeek.group_name,lastWeek.PreScore
from
(select group_name,
Avg(case when datediff(day, asAtDate, getdate()) <= 7 then sumscore else 0 end) as CurScore
[Code] ....
The query consists two parts: from current week and previous week respectively. Each part returns correct result, the final merged result is wrong.
Thought I'd help some folks with rs and dates..
here is some scalar valued functions:
CREATE FUNCTION [dbo].[get_date_only] (@date datetime)
RETURNS datetime AS
BEGIN
RETURN dateadd(day, DateDiff(day, 0, GetDate()), 0)
END
CREATE FUNCTION [dbo].[get_month_end] (@date datetime)
RETURNS datetime AS
BEGIN
RETURN dateadd(ms, -3, dateadd (m,datediff(m,0,
dateadd(m,1,@date)),0))
END
CREATE FUNCTION [dbo].[get_month_start] (@date datetime)
RETURNS datetime AS
BEGIN
RETURN dateadd(m,datediff(m,0, @date),0)
END
CREATE FUNCTION [dbo].[get_today_end] (@today datetime)
RETURNS datetime AS
BEGIN
return dateadd(ms, -3, datediff(d,0,dateadd(d,1,@today)))
END
CREATE FUNCTION [dbo].[get_today_noon](@date datetime)
RETURNS datetime
BEGIN
RETURN DATEADD(hh, 12, DATEADD(d,DATEDIFF(d,0, @date),0))
END
CREATE FUNCTION [dbo].[get_today_start] (@today datetime)
RETURNS datetime AS
BEGIN
return dateadd(day, 0, datediff(d,0,@today))
END
CREATE FUNCTION [dbo].[get_tomorrow_noon](@date datetime)
RETURNS datetime
BEGIN
RETURN DATEADD(hh, 12, DATEADD(d,DATEDIFF(d,-1, @date),0))
END
CREATE FUNCTION [dbo].[get_week_end] (@date datetime)
RETURNS datetime AS
BEGIN
return dateadd(yyyy, datepart(yyyy,
dateadd(weekday,7-datepart(weekday, @date),@date))-1900, 0)
+ dateadd(ms, -3,
dateadd(dy, datepart(dy,
dateadd(weekday,7-datepart(weekday, @date),@date)),0) )
END
CREATE FUNCTION [dbo].[get_week_start] (@date datetime)
RETURNS datetime AS
BEGIN
return dateadd(yyyy, datepart(yyyy,
dateadd(weekday,1-datepart(weekday, @date),@date))-1900, 0)
+ dateadd(dy, datepart(dy,
dateadd(weekday,1-datepart(weekday, @date),@date))-1,0)
END
CREATE FUNCTION [dbo].[get_weekday_end] (@weekday tinyint,
@date datetime)
RETURNS datetime AS
BEGIN
return dateadd(yyyy, datepart(yyyy,
dateadd(weekday,@weekday-
datepart(weekday, @date),@date))-1900, 0)
+ dateadd(ms, -3,
dateadd(dy, datepart(dy,
dateadd(weekday,@weekday-datepart(weekday, @date),
@date)),0) )
END
CREATE FUNCTION [dbo].[get_weekday_start] (@weekday tinyint,
@date datetime)
RETURNS datetime AS
BEGIN
return dateadd(yyyy, datepart(yyyy,
dateadd(weekday,@weekday-
datepart(weekday, @date),@date))-1900, 0)
+ dateadd(dy, datepart(dy,
dateadd(weekday,@weekday-datepart(weekday, @date),
@date))-1,0)
END
CREATE FUNCTION [dbo].[get_year_start] (@date datetime)
RETURNS datetime AS
BEGIN
RETURN DATEADD(year,DATEDIFF(year,0, @date),0)
END
CREATE FUNCTION [dbo].[get_yesterday_end] (@today datetime)
RETURNS datetime AS
BEGIN
return dateadd(ms, -3, datediff(d,0,@today))
END
CREATE FUNCTION [dbo].[get_yesterday_start] (@today datetime)
RETURNS datetime AS
BEGIN
RETURN dateadd(day, -1, datediff(d,0,@today))
END
Then create a Table-Valued Function like so:
CREATE FUNCTION [dbo].[udfCommonDates] (@date datetime)
RETURNS @t table (week_start datetime,
week_end datetime,
lastweek_start datetime,
lastweek_end datetime,
month_start datetime,
month_end datetime,
lastmonth_start datetime,
lastmonth_end datetime,
yesterday_start datetime,
yesterday_end datetime,
today_start datetime,
today_end datetime,
thisweek_monday_start datetime,
thisweek_monday_end datetime,
year_start datetime,
year_end datetime,
tomorrow_noon datetime,
today_noon datetime,
date_only datetime)
BEGIN
INSERT @t
SELECT
dbo.get_week_start ( @date ) AS week_start,
dbo.get_week_end ( @date ) AS week_end,
dbo.get_week_start ( DATEADD(d, -7, @date ) ) AS lastweek_start,
dbo.get_week_end ( DATEADD(d, -7, @date ) ) AS lastweek_end,
dbo.get_month_start( @date ) AS month_start,
dbo.get_month_end ( @date ) AS month_end,
dbo.get_month_start ( DATEADD(m,-1, @date) ) AS lastmonth_start,
dbo.get_month_end ( DATEADD(m,-1,@date) ) AS lastmonth_end,
dbo.get_yesterday_start ( @date ) AS yesterday_start,
dbo.get_yesterday_end ( @date ) AS yesterday_end,
dbo.get_today_start (@date) AS today_start,
dbo.get_today_end ( @date ) AS today_end,
dbo.get_weekday_start(1,@date) AS thisweek_monday_start,
dbo.get_weekday_end(1,@date) AS thisweek_monday_end,
dbo.get_year_start(@date) AS year_start,
dbo.get_year_end(@date) AS year_end,
dbo.get_tomorrow_noon(@date) AS TomorrowNoon,
dbo.get_today_noon(@date) AS TodayNoon,
dbo.get_date_only(@date) AS DateOnly
RETURN
END
Now the RS folks might be thinking but how does this help me as I need a dataset and a dataset can only be based on a Stored Procedure or a direct table. No problem create the following stored procedure:
CREATE PROCEDURE [dbo].[uspCommonDates] AS
begin
set datefirst 1
declare @date datetime
set @date = getdate()
select * from dbo.udfCommonDates(@date)
end
Now you've got a stored procedure to use as a dataset...Now in reporting services add a new dataset:
Now go to the report parameters section of the report:
Now pick that dataset dsFunctions (or whatever you called it) and then pick any of the value fields from the scalar functions such as:
Now when you run the report it uses the scalars:
If you have questions feel free to ask :).
Hope this helps someone
I am trying to set default print settings for a report on Reporting services.
I need to make to make a page print out on landscape by default.
I cant seem to find this option anywhere.
Is there any way to default to the first day of the month in a SSRS expression. I'm looking to do the reverse of the EOMONTH() function.The date value is coming from a parameter @BegDate and formatted YYYY-MM-DD. So if the parameter is set to 2015-08-31 it would show 2015-08-01
View 2 Replies View RelatedI have searched the web and have not had any luck on finding the issue to my problem. I'm sure it's probably simple, so here it goes.
When receiving the following error "The permissions granted to user '' are insufficient for performing this operation"
Now, I would like to add to the error message shown above an extra line below it on the web page to reflect something like "Please contact XXX @ XXX if you feel that you need to have your login issue resolved" ...or something meaningful in addition to the default error messages.
I am not getting this error normally, as I have made a typo when login in on purpose! I am just trying to find a way to add more detail to the current error message or change the message to what I want it to say. This would go for any error message received by an end user received through SQL Server 2005 Reporting Services.
Do I have to create some sort of filter to read the message coming back from within SOAP? Are these messages stored in ReportingServices database or htm file?
Thanks!
ICE
I have a report with datetime parameter which is required to be optional (there should be an option not to select this parameter which would cause in not narrowing result of this report by this parameter).
I used datetime parameter
@daTo (to have the calendar control for selecting date) and check on "Allow Null" value. Here is default Value.
I've also tried to set DefaultValue expression was "=Nothing".
IN my query of data set, here is the part I use the parameter @daTo
... Where (@daTo IS NULL OR TRUNC(@daTo) >= TRUNC(pe.start_time) ....
But when I run the report, I got below error:
ORA-00932: inconsistent datatypes: expected DATE got NUMBER
I think it @daTo value actually not null so it try to TRunc the value
I don't know how to set null value default in my report.
I'm trying to have a default or null value in the dropdown list of the parameters on SSRS report. The dataset is bound with the Dynamics-AX 2009 AOT query. In the screen shot below you can see that I need a show All option in the dropdown list.
View 7 Replies View RelatedHI,
I am trying to set the following default parameter : datepart("m",now()). The parameter is an integer
If I do this through visual studio 2005 it works just fine.
However I need to change this for a linked report and when I do the same thing in the viewer (using the "Overide Default" key) I get the following error
"The parameter Month contains a value that is not valid. This parameter takes an integer as a value"
Can anyone suggest a way to get arround this ?
I created a parameter with available values from a dataset.
By default i want it to display the maximum value. and then the user can select the dates if he does not like the default value.
How to i do this. because when i tried to set the paramter default value to max(dataset!dt.value) it says expression canot be used.
How to do this. Should I create a dataset with maximum value and then assign it to this one.
I created a tabular model, and used it as a source for the power view. Is there any possibility to set a dynamic default value for the filter. My model has a field named 'CalendarMonth', by default - filter should take current month. I would like to know is there any possibility with out changing the data in the source.
View 4 Replies View RelatedTried to uninstall SQL Server 64-bit on Windows 2003 remotely. All components uninsntalled properly except Reporting Services.
The log file lists the following error -
/*****
ReportingServicesService!library:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerDatabaseUnavailableException: The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerDatabaseUnavailableException: The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing. ---> System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
*******/
Now I cannot see Reporting Services under Add/Remove programs (ARPWrapper.exe /remove). It is also not displayed when using Windows Installer Cleanup Utility (msicuu2.exe). I can start the default instance of RS via Reporting Services Configuration manager and it can also be also started under Windows Services. BTW, the IIS folder structure is under the default website for Reports and ReportServer is present.
So, now how do I go about uninstalling SQL Reporting Services when I cannot see it (as an installed program) without rebuilding the machine ?
Thank you.
Adeaweb
Tried to uninstall SQL Server 64-bit on Windows 2003 remotely. All components uninsntalled properly except Reporting Services.
The log file lists the following error -
/*****
ReportingServicesService!library:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerDatabaseUnavailableException: The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerDatabaseUnavailableException: The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing. ---> System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
*******/
Now I cannot see Reporting Services under Add/Remove programs (ARPWrapper.exe /remove). It is also not displayed when using Windows Installer Cleanup Utility (msicuu2.exe). I can start the default instance of RS via Reporting Services Configuration manager and it can also be also started under Windows Services. BTW, the IIS folder structure is under the default website for Reports and ReportServer is present.
So, now how do I go about uninstalling SQL Reporting Services when I cannot see it (as an installed program) without rebuilding the machine ?
Thank you.
Adeaweb
I know that SSRS default rendering formats is HTML. is there anyway we can change this behaviour to render in XM format for specific reports.
View 5 Replies View RelatedI installed SSRS 2014 Reporting Services on a 2008R2 Enterprise server. When I try to subscribe to a report (also SQL 2014), the default rendering is MHTML. I want to change this default to EXCEL.
I updated the rsreportserver.config file and restarted SQL Server Reporting Service. Now, the default rendering for a subscription is 'XML file with report data' which is the first <Render> data element. If I change
<DefaultRenderingExtension>EXCEL</DefaultRenderingExtension> back to <DefaultRenderingExtension>MHTML</DefaultRenderingExtension>
And restart SSRS Service, the default subscription rendering is MHTML.
<DeliveryUI>
<Extension Name="Report Server Email" Type="Microsoft.ReportingServices.EmailDeliveryProvider.EmailDeliveryProviderControl,ReportingServicesEmailDeliveryProvider">
<DefaultDeliveryExtension>True</DefaultDeliveryExtension>
<Configuration>
[Code] ....