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

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

Calculated Column

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :Sql Server


I am making a report using Microsoft Reporting services 2008. I need to calculate a field base on the other column. Suppose I have the data like this


Actual Data



Now i want to make a new column whose values are basically sum of previous column in this fashion.


View Complete Post

Actual Data Calculated Data

More Related Resource Links

How to get character count in 'Multiple Text 'column using Calculated Column?


Hi All,

I have a multiple text box in a list

I want

  • A column which lists number of characters in multiple list column example 188, 199 etc
  • Multiple character column must not have more than 200 chars
Is this possible?

Appreciate all the help!


Trying to set Calendar Time Interval Using Calculated Column, but getting Error



So i was trying to use a calculated column that added 7 days to the start date of a calendar item. The calculated column worked fine because i checked with several tests. Then i tried using the Column as the End Time in the Time Interval Setting in the Calendar View. This broke Sharepoint. Not the normal graceful error im using to seeing from Sharepoint but the Server Error Page when a dump happens in a ASP page. I havent enabled the full error page because i assume its not like i can fix it, i dont have the source code.


Does anyone else experience this? If so is it a known problem and being worked on?




computed column specification - When is it calculated?

on insert , select...?  It's better than Trigger? thanks.  

Sharepoint: In Calculated Column, Code with multiple "IF" condition does not work.

Implemantation:  Calculate expected resolve date exclude "Saturday" and "Sunday"  based on Priority and Severity.Columns are:1. Priority:2. Severity:3. Raised on: Date record createdCode: Below is the code which contains multiple "If" conditions. For quick undersatnding, i separated major If condition. Below code does not work and sharepoint gives me Sytax error message. =IF(OR(Priority="Critical",Severity="Critical"),IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+3,[Raised on]+1),     IF(OR(Priority="HIGH",Severity="HIGH"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+4, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+4,[Raised on]+2)) ,   IF(OR(Priority="MEDIUM",Severity="MEDIUM"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+5, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+5, IF(TEXT(WEEKDAY([Raised on]+3),"dddd")="Saturday",[Raised on]+5,[Raised on]+3)) ) ,   IF(OR(Priority="LOW",Severity="LOW"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+6, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+6, IF(TEXT

Use Sharepoint Calendar Start Time field in calculated column

I'm trying to limit the calendar view to current week using the Sharepoint defined field Start Time. However, when I display the serial number behind the Start Time it looks like it is actually giving me the serial number for the Created Date field. I believe it is because the appointment is reoccurring but I'm hoping there is a way around it. I created a new testdate field and manually entered the date and set those appointments as all day events however they are not reocurring appointments. The testdate returns the correct serial number however the start time returns an incorrect serial number. SerialNumber1=DATE(YEAR([Start Time]),MONTH([Start Time]),DAY([Start Time])) SerialNumber2=DATE(YEAR([testdate]),MONTH([testdate]),DAY([testdate])) Start Time  SerialNumber1 Testdate  SerialNumber2 8/31/2010 40420 8/31/2010 40421 8/31/2010* 40405    9/1/2010* 40405    9/2/2010* 40405    9/7/2010 40427 9/7/2010 40428 9/13/2010* 40405    9/14/2010 40434 9/14/2010 40435 9/14/2010* 40405    9/15/2010* 40405    *These are reoccurring appointments scheduled as all day events. The others were entered as one time appointments scheduled as all day events.

using [content type] in calculated column

I want to get the content type in the calculated column. [content type] is available in Moss not able to use that in 2010. Any idea?

Problem when using calculated column as column group in a view

Hi,   I have a list with a calculated column named 'FullName', the formula is: "FirstName & " " &  LastName". I created a view group by 'FullName' column. The follow error appeared on the column:   <!-- #RENDER FAILED -->   Please help

Weird Date vs Date/Time issue using a calculated column

I'm attempting to use the fab 40 attendance template. I don't need the time to show - Im able to hide that on the forms with jquery (endusersharepoint.com thank you!!) I WAS ATTEMPTING to create a calculated column called Start Date where the formula simply reads '=[Start Time]' When it's set to display 'Date Only' the date is off by a day. If I switch it to 'Date & Time' I get the correct date. Huh?

Set a Calculated column as hidden in a content type

Hello, I'm building a custom list with several columns, including a Calculated column. This calculated column simply takes the value of a choice column in the same list to convert this value to a single line of text value. I do this because when adding a lookup column to this list, I cannot select Choice columns as additional columns, but I can add the calculated column. Speaks for itself that this calculated column only needs to exist in the background, and end users should not see this column in the Add/Edit/Display forms. In add/edit forms the column is not displayed, but in the display form it gets displayed. Piece of cake I thought, I'll just set it as hidden in the content type used for the list. When I open the column the column settings (required/optional/hidden) is grayed out, so I cannot set it to hidden. In SP2007 this was possible, why can't I do this anymore in SP2010? Do I miss some feature in order to do this, or is there a good reason why this seems to have changed in SP2010?

Calculated column and hyperlink field type

Hi I have customer who is asking me if this is possible to provide filter based on the HyperLink field, where he could easly limit results to only those items where link field is filled. As filtering on hyperlink column type is not supported I was thinking to buld some calculated field based on it to return YES (if link is provided) or NO (if link is not provided). The problem is that hyperlink field type is not avialiable on the list of field to be used on calculated field. is there some workaround for that ? thanks for help   Mariusz Gorzoch Blog : http://mariusz.gorzoch.pl Twitter : http://twitter.com/MariuszGorzoch Facebook: http://www.facebook.com/mariusz.gorzoch

Error when trying to add calculated column: ' Item has already been added. Key in dictionary:'

I created a subsite under a subsite in my MOSS 2007 site collection. Then I am trying to create a 'local' site content type for Quizzes. Next I am trying to create a calculated column and right after I specify Calculated Column as the type I get a mysterious error Now, Root Cause Analyst Name is a    Root Cause Analyst Name is a site column defined in the Root web, and referenced in the parent subsite, but it has nothing to do with my present effort. ? Can I not create content types in a sub-sub-site, or should I create them all in the root web? Here's the error:     Item has already been added. Key in dictionary: 'Root Cause Analyst Name_Root_x0020_Cause_x0020_Analyst_x0020_Name'  Key being added: 'Root Cause Analyst Name_Root_x0020_Cause_x0020_Analyst_x0020_Name'   at System.Collections.SortedList.Add(Object key, Object value)    at ASP._layouts_fldnew_aspx.__Render__control10(HtmlTextWriter __w, Control parameterContainer)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)    at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer)    at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output)    at

Calculated Column: Text ==> Date and Time Column (Date+Time)





I have a little question about calculated columns in WSS 3.0 (not MOSS 2007)


How can I have a calculated column which is a Date+Time based on a text_column

Converting YYYYMMDD_HHMM (time = 24 hour format) format  ==> Date+Time



20070629_0848 converting to 29/06/2007 08:48


==> I have already a formule, but with teh DATE(...) function, you cannot give the hour-minute-seconds as a parameter, so the time is always 00:00 in WSS 3.0 (and yes, i have selected date+time as result-type for the column)


Is this possible in WSS to calculate a full date out of a text, maybe if i use two seperate text-columns, and convert a to date and one to time and a third which combines the two...


It would be a huge help if somebody could give me som advice to calculate a full date+time out of one or more text-columns....





Errors with calculated columns, the column posts, but doesn't calculate.



I have a custom list that isn't processing calculated columns anymore.

When I post a calculated column I get one of two error messages...either "SQL Server may not be started" or "The value does not fall within the expected range".  I've noticed the sql message before but the changes are made and calculations in the past have worked ok.  Now that the "value" error is cropping up it's quit calculating the columns.

i.e. I open a calculated column, simply have it reference a numeric field (=[MyNumberField]).  When I hit ok I get one of the two error messages.  When I look at the value of the calculated column it's blank.

Any references to articles, etc. would be helpful.  There are 406 columns in this list...

Best Regards,


Summing a calculated column with comma's in sharepoint designer



Sharepoint designer has the trait of getting goofed up with calculated columns that display with a comma.  I typically deal with this by doing a format-number(number(translate(@MyCalculatedColumn,',','')), ###$%%^formatstuff).  this replaces the comma's with nuthing so it will format as a number.

I'm trying to do a sum now...is this possible?


  <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[contains(@FileRef,$TheIDweWant)]"/>
  <xsl:variable name="zNumMales" select="sum($Rows/@MaleLives)"/>
  <xsl:variable name="zTotalMaleVolume" select="sum($Rows/[number(translate(@MaleVolume,',',''))])"/>

The zNumMales works fine...it's just a number column populated by a workflow.

The zTotalMaleVolume is calculated, has commas so it displays as blank, we need to get rid of the comma's.  the above syntax is upchucked...anyone happen to know what it is?



disable the sub/grand total column in calculated memebers


Is it possible to disable the sub/grand total column in calculated memebers programmatically. I don't want to display the sub/grand totals in pivot table? I know I can manually disable the sub/ grand totals in pivot table.



ListData.svc fails if list has calculated column with Yes/No (boolean) return type


I have a list with a calculated column whose return type is Yes/No.  If I try to browse to the list or a list item using REST via ListData.svc, I get the error "An error occurred while processing this request".  Can't seem to find anything in 14\LOGS or the System or Application event logs.  I've tried multiple calculation formulas such as:



Both display "Yes" when viewing through the SharePoint UI and are sortable and filterable.  If I change the calculated column return type to anything else (single line of text, currency, date/time, etc.) and update the formula as necessary, ListData.svc displays the list item XML as expected.  If I replace the calculated column with a regular column whose type is Yes/No, ListData.svc displays the list item XML as expected.

Is this a known bug?  Is there a workaround (other than manually casting to bool in my code)?

Calculated column Default Value not retained in site template.


On a new blank site, create a custom list and make these changes to the Title field:

  1. Change the name to Date
  2. Change Required to No
  3. Change Default Value: to Calculated Value
  4. Enter the formula "=TEXT(Today,"d-mmm-yyyy")" so that it defaults to today's date

Save thsi site as a template, then create another site based on this template. Items 1 and 2 above are carried over to the new site but items 3 and 4 revert to the default setting.

Does anyone know how to get around this ... er ... abnomaly?

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