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


Top 5 Contributors of the Month
Imran Ghani

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Get Current Weeks, Months, Years record in sharepoint

Posted By:Sunil Yadav       Posted Date: May 27, 2010    Points: 25    Category: SharePoint    URL: http://www.dotnetspark.com  

I this article i am going to show how we get weekly, monthly, yearly data using calculated column in sharepoint.
 

Current Week:

Firstly you need to create a calculated column lets say Last Week
Now add the formula as Created+7

Create a view lets call it Weekly View and then compare a field in view with [today](is greater than or equal to) as shown below

 

Current Month:

Create a calculated column "MonthStart" and "MonthEnd"
The "MonthStart" column formula should be

=DATE(YEAR([Created]), MONTH([Created]), 1)


The "MonthEnd" formula should be :

=DATE(YEAR([Created]), MONTH([Created])+1,1)-1


Create a view lets call it Monthly View and then compare a field in view with [today](is less than or equal to) and [today](is greater than or equal to) as shown below
  
Similarly for the previous month as shown below.

Previous Month Start =DATE(YEAR([Due Date]), MONTH([Due Date])+1, 1)
Previous Month End =DATE(YEAR([Due Date]), MONTH([Due Date])+2,1)-1


In the same manner we can create a yearly view.

Current year:

Start Year =DATE(YEAR([Due Date]),1,1)
End Year =DATE(YEAR([Due Date]),12,31)


 Subscribe to Articles

     

Further Readings:

Responses
Author: Pentalogic         Company URL: http://www.dotnetspark.com
Posted Date: May 28, 2010

I''ve written a surprisingly similar article here

http://blog.pentalogic.net/2009/11/howto-filter-items-current-calendar-month-view-sharepoint/
Author: spy66         Company URL: http://www.dotnetspark.com
Posted Date: June 10, 2010

Thanks for the article, it was helpful.

I have a similar task I'm struggling with, I need a calculation that returns the Month that the task Starts on and another calculation that returns the current Month.

Any ideas? Thanks!

Author: spy66         Company URL: http://www.dotnetspark.com
Posted Date: June 10, 2010

Gah double post, sorry
Author: Sunil Yadav         Company URL: http://www.dotnetspark.com
Posted Date: June 14, 2010

Hi,
Go through following link i have created similar solution here..

http://www.sunilyadav.net/?p=549

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

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