.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to Correlate Last weekday of previous Month and First Weekday of current Month ? - T-SQL 2005

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :Sql Server
Hi friends, below is my detail description. I woulld like to show busines users Previous Months Last Weekday in Drop Down List as a Parameter. Now, if they select Previous Months Last Weekday, then i need to pass First weekday of Current month. How can i correlate this things ? if you need more information, let me know.   Thanks.

View Complete Post

More Related Resource Links

How i can view last 5 days records in current Month

Suppose i have a tableAppno Receive_Date Send_Date 1 9/3/2010 9/3/2010 2 9/3/2010 null 3 9/4/2010 9/4/2010 4 9/9/2010 9/9/2010 i m trying to run this select * from search where datediff(d,send_Date,getdate()<5

first date of previous month?

How to get the first date of previous month?
PS.Shakeer Hussain Hyderabad

Selecting current,previus month values


hi friends,

consider that i have columns like tax_amount,item_amount,month,year in a table..

i want to get

current month & year - tax_amount,item_amount

previus month and current year- tax_amount,item_amount

current month &  previus year - tax_amount,item_amount

how to get all the values in a single select query.

i am waiting for ur reply..

Count of Rows - Records between month - T-SQL 2005


Hi Below is my Scenario.

Record                       Start Date                           END Date

  1                              01/02/2008                          04/05/2009

  2                             01/25/2008                           06/19/2009

  3                              02/02/2008                   

MDX find last (flagged) day of previous month


I need to find last working day of previous month in Calendar hierarchy for a given date - any help on this? The last day of every month is indicated by MonthEnd flag that is related to Date attribute. I need to get figures for this date in MDX query.

My Calendar dimension has Calendar hierarchy that has year, month, date levels. Also, there is a MonthEnd attribute related to date that is either yes/no.

Thanks. Pl note I cant use SSAS stored proc .


I have a solution but seems to be complex.

select {
		{NULL:ClosingPeriod ([Calendar].[Calendar].[Date], 
	).Item(0).Item(0) ,

	[Calendar].[Calendar].[Date].&[20100925]} on 0


MDX to pick the data from first day of the current month



I need to make a mdx query to pick the data from first day of the current month.

SELECT [Measures].[Internet Sales Amount] ON COLUMNS,

[Date].[Fiscal].[Date].MEMBERS ON ROWS

FROM [Adventure Works]


The above query returns around 4 years of data, but I need the data from first day of the current month.


Could anybody help me out!!!






IN SSAS 2005, total count is incorrect for a partial month



IN SSAS 2005, when I navigate Cube->browser and I drag my fields "Day of week" to rows and couple of measures namely "M1" and "M2" to columns

and applied a filter "hierarchydate" in the filter section(eg partial month Jan 10 to Jan31), I get the total count incorrect. I also have the following observations

1) for example "Instead of giving Sunday "Sub total" for that partial month i.e "Jan 10 to Jan31", it is displayed with all the Total Sunday's count for all the years

2) IN Cube-> browser , it is working fine, if I apply the filter in "select dimesion" section instead of applying filter in "drop filter fields section"

Is there any such kind of issue in SSAS 2005?

Please reply me ASAP if you have any information

Need Help - Grouping multiple fields to get top 10 for month then using that data to get previous mo



I’m querying a database in BIDS using SQL 2005 to produce a report in SSRS. All the information I need is in one table.

The table has 3 columns. The data within each column can be identical but when the 3 columns are grouped together they make up a unique set.

For example:
Month     Col 1     Col2       Col3
201009   Field A   Field B   Field C
201009   Field A   Field B   Field D

201009   Field A   Field B   Field D

201009   Field A   Field E   Field C
201009   Field B   Field B   Field F

201009   Field B   Field B   Field F
201009   Field B   Field G   Field G
201009   Field C   Field B   Field F

I need to count the number of times these unique sets appear each month and produce a report showing the to

SPQuery to get all Items Modified in Current Month/Year


I have a SharePoint List. Using CAML I need get all the Items that are modified in the current Month/Week/Year.? 

Can anybody help me to achieve this?




How do you determine that the last day of the previous month falls on a Saturday or Sunday?


How do you determine that the last day of the previous month falls on a Saturday or Sunday?

I know that this will give me the last day of the previous month




Need YTD when pulling only current Month detail.



I have report in reporting services that shows Sales for the Current  "Fiscal Period In Year" Which would be the 4 weeks of this month.  This is then compared to last years sales for the same Period. Now, my problem is , if i filter this mdx query by period, then I cannot get the YTD value . How do i get a the YTD, if im filtering the rest of the query down to the Current Period?


 I originally used the code below and then just filtered the groups in the report to only show the current period. This works, but the report is very slow because of the Query pulling all sales.  I know there has to be an easier and more efficient way to get this running with the YTD without needing all the detail rows.




 SELECT NON EMPTY { [Measures].[PL Gross Sales Amt] } 

 ON COLUMNS, NON EMPTY { ([Time].[Fiscal Week].[Fiscal Week].ALLMEMBERS 

 * [Sell To Customer].[State].[State].ALLMEMBERS 

 * [Time].[Fiscal Year].[Fiscal Year].ALLMEMBERS 

 * [Time].[Fiscal Period In Year].[Fiscal Period In Year].ALLMEMBERS 

 * [Sell To Customer].[Customer].[Customer].ALLMEMBERS 

 * [Sell To Customer].[Customer C

Trouble getting current month



I'm trying to get Current month unique ID to return as a default parameter value for reporting services parameter.


I try it like this:


MEMBER [Measures].[CurrentMonth] 
SetToStr(EXISTS([Date].[Month].[Month].ALLMEMBERS,Filter([Date].[Date].ALLMEMBERS, [Date].[Date].MemberValue = vba![Date]())))

SELECT {[Measures].[CurrentMonth]} ON COLUMNS

FROM [Cube]

that works, but returns it in a set format ({[...]})

however, as soon as I try to get a single member out of it (it's only a single member there anyway!), I get NULL. No metter if I try Item(0).MemberValue, or .CurrentMember, or MemberToStr, I always get NULL.


What am I doing wrong?

MDX to compare current month's revenue with last month revenue?


Hi I have SSAS 2008 cube and PPS 2007.

I created two NAMED SET : [This Month] and [Last Month]. Now I would like to calculate member which compare current month’s revenue with last month revenue like
[Revenue Difference] = [This Month] - [Last Month] revenue &
[Revenue Difference %] = [This Month] - [Last Month] revenue in percentage.

I would like to create MEMBERS/SET/SCOPE(not sure which is right one?) for just drag-and-drop to cube browser? Any SSAS 2008 MDX please.Thank You....

how to restict time till previous month


Hi all,

i have filter as time period as follows.

2010 (yr)
1    (month)
2011 (yr)
1   (month)

now i need to restrict the time period up to previous month...i.e when we select time in filter need to see upto 2011 year & 4th month..no current month & future month should be
seen. At any time it should show upto previous month of the time...pls let me know how to perform
this in mdx


dropdownbox which selects records based on criteria (TODAY, THIS WEEK, THIS MONTH, etc)


I have a dropdownbox which I want to use to search records based on a timescale. The gridview populates results based from that search.

So here is how I want to work this;

If a user selects "today" - a list of records input today are populated. If "this week" is selected, a list of all records added within that week from todays date is populated.

I created a forum on this issue previously but to no avail whatsoever. How do I work around this problem?

Help would be much appreciated

Azure One Month Pass


Just saw this Azure offer.  You can try Azure for free, no credit card required, for a full month.

25-08-2010 7-24-07 PM

Get all the details here and read the fine print (like US only)

Bookmark and Share

Crawler fails to register date properties of user profiles with the month of January, April, August


This seems to be a bug when the crawler search the user profiles in MOSS 2007.  When crawled, user profiles with a SPS-HireDate in the months of January, April, August and December will be detected, but a full-text (SQL) search returns those profiles without the HireDate field.

User profiles with HireDates in other months work correctly, returning the HireDate in the search.  And changing the month of a problematic user profile also fixes the problem.

This problem is also reflected in the fact that while we have 499 user profiles using the SPS-HireDate property,  the managed property page from the search section only has 350 items with the HireDate property.

We're running MOSS 2007 32bit with SP2 with an English language base and the Spanish language pack. I'd considered date format problems, but I can't imagine how some months would work, while others wouldn't.

Any ideas?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend