If statement for calculated column
Hi, I need to know if its possible to do the following in a calculated column
if column1 value => 1
display the name of column1 + the value of column 1
is this possible?
Hi hein,
You can return your calculated column value as "Number" type, set the "blank space" in your formula, see the formula as follow,
=IF([A4 Printing Paper Box]>0,"[A4 Printing Paper Box]"&[A4 Printing Paper Box]," ")
http://msdn.microsoft.com/en-us/library/bb862071.aspx
Thanks
Daniel Yang
TechNet Community Support
Similar Messages
-
I am trying to learn HANA on my own.i have product id,product name,delivery date and Grossamount in my calculated view.i am trying to create calculated column where i need Grossamount in two columns based on delivery date.I have 2012 and 2013 as values for my delivery date.so i have created two column as grossamount_2012 and grossamount_2013.if i have delivery date as 4thdec,2012 i want the grossamount value to be in coloumn grossamount_2012 and the grossamount_2013 should be blank.i have written an expression like this
if("Deliverydate" <= longdate(2012-12-04),"Grossamount","0")
and it looks like this is wrong.i am getting the text Grossamount rather than values for that field in my output.so can anyone help me please?Hi chandra
i am trying to get the same result by using sql script and CE functions.i have written the following code
select A."PRODUCTID",
E."TEXT" as "PRODUCTNAME",
C."COUNTRY",
D."DELIVERYDATE",
Sum(D."GROSSAMOUNT") as "GROSSAMOUNT"
from "SAP_HANA_DEMO"."sap.hana.democontent.epm.data::EPM.MasterData.Products" as A
inner join "SAP_HANA_DEMO"."sap.hana.democontent.epm.data::EPM.MasterData.BusinessPartner" as B
on A."SUPPLIERID" = B."PARTNERID"
inner join "SAP_HANA_DEMO"."sap.hana.democontent.epm.data::EPM.MasterData.Addresses" as C
on B."ADDRESSID" = C."ADDRESSID"
inner join "SAP_HANA_DEMO"."sap.hana.democontent.epm.data::EPM.Purchase.Item" as D
on A."PRODUCTID" = D."PRODUCTID"
inner join "SAP_HANA_DEMO"."sap.hana.democontent.epm.data::EPM.Util.Texts" as E
on A."NAMEID" = E."TEXTID"
GROUP BY A."PRODUCTID",E."TEXT",C."COUNTRY",D."DELIVERYDATE";
this is working fine but i want to split the grossamount based on current year and last year.Any idea how to do this
In calculation view using script can we use if and case statements? -
CASE statement in Calculated column
Hi Frzz,
I have below requirement in Calculated column with CASE statement. Could some one help me how to achieve this with case statement.
String = 0Hello
01Hello
012Hello
0123Hello
If 1st Character of the string is '0' then - 0Hello
1st 2 characters of the String is '01' - 22Hello
1st 3 characters of the String is '01' - 333Hello
1st 4 characters of the String is '01' - 4444Hello
Thank you.
Best Regards,
Krishna.Hi Krishna ,
Using IF and MATCH to do that: ( I took one of the conditions you specified )
IF(match("STRING1",'??0??'),'333Hello',"STRING1")
Output:
Regards,
Krishna Tangudu -
How to provide dynamic labels for calculated columns in HANA calc views
Hi all,
we have the requirement to provide dynamic labels for some calculated columns in our calculation view - how to do that?
Thanks and kind regards,
AlexanderCalculated Columns can only generate a value from fields of the current item. And only some types of fields (for example, it can't use a lookup column).
Consider using a workflow to accomplish your goal.
Scott Brickey
MCTS, MCPD, MCITP
www.sbrickey.com
Strategic Data Systems - for all your SharePoint needs -
Scripting Error for Calculating Columns
Hello,
I have created a table in which I need to sum the rows and columns. The script is working for each row, but it is not for each column. I've looked through this forum and found several examples that should work for me but I'm still receiving an error; accessor ... is unknown (where... is the path). I would appreciate any assistance.Well,
as I said, the reference is wrong.
In your form, there is no row named "Row", but 4 rows named individually "Row1", "Row2" etc.
The script you use looks for all instances of a object named "Row"m this means Row[0], Row[1], Row[2] and so on..
So just rename all the 4 rows into "Row" and your script will work. -
SQL statement for calculating performance targets
Hi
I have taken of the admin of a database which stores project goals and scores. I have to develop a way to calculate how well all projects meet these scores. The table concerned is called goal and looks like this:
goal
goal_name
project_code
current_value
good_value
bad_value
This can be for many different goals, for example if a project wants to get up a goal of having no more than 5 bugs in the project. I can also set a bad value, say 20, so if any projects have 20 or more bugs, triggers or alerts can be sent So I can enter into this table. The reason for putting 5 for good not 20 is because these scores are to be realistic.
project_code = foo
goal_name = software bugs
good_value = 5
bad_value = 20
However, some goals may have the values switched and be in a much higher range, or may even be a percentage. For example one for number of sales could be
project_code = foo
goal_name = software sales
good_value = 200
bad_value = 50
or project delay
project_code = foo
goal_name = sproject delay
good_value = 0%
bad_value = 50%
i am trying to develop a SQL statement so I can get a % score of how well a goal is performing, so I can see
What is the goal % for all foo goals
Or what is the goal % for goal 'software sales'
And also more importantly, how well are the goals doing globally.
The requirement for doing this is using a single SQL statement, well, one SQL statement for the requirements I listed above, so for example the semantics are
SELECT average(goal perforance) WHERE .... project = foo .... or goal = software sales... etc
I am having trouble doing this, I have been banging my head against mydesk all day. the biggest thing is thowing me off is that the good value can be higher or lower than the bad value, and I am having trouble visualizing how to but this conditional statement in SQL
One more thing, the percentage returned should never be more than 0% or 100%.
If anyone has any ideas or pointers, please help me out,
Thanks for your time,
Message was edited by:
user473327I am having trouble doing this, I have been banging
my head against mydesk all day. the biggest thing is
thowing me off is that the good value can be higher
or lower than the bad value, and I am having trouble
visualizing how to but this conditional statement in
SQLI haven't looked at your requirements in detail cos I don't have time for such cumbersome tasks. However, you could have two UNION'd select statements, one which caters for the good > bad and one which caters for the good < bad. Also and alternative would be the use of DECODE or CASE statements in your select which are good for switching things around based on conditions.
;) -
SQL Statement for Calculating Total Staff Absence
Hi Guys, I hope I'm posting this in the right location.
I have a database with the following information in a table.
StaffID, StartDate, EndDate,
I currently have the following statement to calculate total days between dates as follows;
SELECT StaffID, DATEDIFF(day, StartDate, EndDate) AS DaysAbsence, StartDate, EndDate, ABID FROM Table;
I now wont to group all the absences by StaffID and calculate the total number of days.
How would I go about doing this I have tried the following which didn't work.
SELECT StaffID, SUM(DATEDIFF(day, StartDate, EndDate)) AS DaysAbsence, StartDate, EndDate, ABID FROM StaffAbsence;
and generated the following error:
Msg 8120, Level 16, State 1, Line 1
Column 'StaffAbsence.StaffID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Any suggestion on how to go about fixing this?SELECT StaffID
, SUM(DATEDIFF(day, StartDate, EndDate)) AS DaysAbsence FROM StaffAbsence
Group by StaffID;
Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com -
Select Statement for Varray columns
Hi all,
How should my select statment look like,if i want to see my data as following: I am using oracle version 9.2.0.8
std_id std_name name teacher
100 raghu shekar telugu
101 tedla prabhakar hindi
101 tedla das science
101 tedla thomas social
101 tedla john english
create or replace type subj_attr_t as object
(name varchar2(50), teacher varchar2(100));
create or replace type subj_attr_list_t is varray(100) of subj_attr_t;
create table student
(std_id number,
std_name varchar2(100),
staff subj_attr_list_t);
insert into student values(100,'raghu',subj_attr_list_t(subj_attr_t('shekar','telugu')));
insert into student values (101,'tedla',
subj_attr_list_t
subj_attr_t('prabhakar',hindi'),
subj_attr_t(das','science'),
subj_attr_t('thomas','social'),
subj_attr_t('john','english')
Thanks
RaghuHi ,
Anthony the query you have provided was working fine,y'day i was not giving actual table, now I am giving actual table and data which i need query for, i changed table name. I am providing only small set of data in varray column for space limitation.My oracle version is 9.2.0.8
CREATE TABLE raghu
(request_id varchar2(20),
status char(1),
system_impl varchar2(50),
art_request_id number,
call_data raghu_parameter_list_t);
CREATE OR REPLACE
type raghu_parameter_LIST_T is VARRAY(100) OF raghu_PARAMETER_T;
CREATE OR REPLACE
type raghu_PARAMETER_T as object
NAME VARCHAR2(30),
VALUE VARCHAR2(2000));
REQUEST_ID STATUS SYSTEM_IMPL ART_REQUEST_ID CALL_DATA
EA39051 Y CREATE_ACCOUNT 27105 ((OPERATOR_GPN, 43158174), (STD_ID, 4), (STD_SPECIFIC_ATTRIBUTES, UBSAES01:2JrNGWZMXOqtOX8GImU6KQ==), (ACCOUNT_NAME, anuq1005), (ACCOUNT_TYPE, 8), (USER_ID, 11332101))
EA39045 Y CONTACT_MANAGEMENT_REQUEST 27084 ((OPERATOR_GPN, 43158174), (CONTACT_NAMING_AUTHORITY, PCC), (CONTACT_ID, 11332037), (FIRST_NAME, anuq10622), (LAST_NAME, 04062006), (EMAIL, [email protected])
EA39046 Y CONTACT_MANAGEMENT_REQUEST 27085 ((OPERATOR_GPN, 43158174), (CONTACT_NAMING_AUTHORITY, PCC), (CONTACT_ID, 11332037), (FIRST_NAME, anuq10622), (LAST_NAME, 04062006), (EMAIL, [email protected])
SELECT r.request_id,r.status,sub.name,sub.value
FROM raghu r,table(SELECT s.call_data
FROM raghu s
WHERE s.request_id = r.request_id) sub;
ERROR at line 2:
ORA-01427: single-row subquery returns more than one row
Please can i know why I am getting this error
Message was edited by:
Raghu
user584123 -
Logical AND , OR operations in calculated Column
Hi Frzz,
I need to apply AND & OR operators in IF statement of Calculated Column. Could some one help he how to achieve this.
IF( employeetype = = 'temporary' AND experiance == '5years' )
IF( employeeDesignation == ' BA' )
logic
ELSE IF (employeeDesignation == 'AC')
logic
ElSE
logic
ELSE IF ( employeetype = = 'temporary' OR experiance == '5years' )
IF( employeeDesignation == ' BA' )
logic
ELSE IF (employeeDesignation == 'AC')
logic
ElSE
logic
ELSE
Logic
Best Regards,
Krishna.Hey Krishna, ( feels like calling myself )
Just have a doubt here, before proceeding for the solution
1) Why do you want to convert it into a string if it is a number?
2) what is the data type of the field? is it VARCHAR?
If you feel like it has to be converted , then why don't you convert everything into a string so that
1) if there is a number it will get converted into a string
2) if there is string, it will again convert ( which should not be a problem )
Can you be more clear on what you wanted to do there?
Regards,
Krishna Tangudu -
DAX - IF statement and filters within calculated column
Hi all,
I've got a bit of a complex formula I'm trying to run, but I'm not quite there yet. I don't know where/how/if I can place a filter within my IF statement for a calculated column due to so many variables. I either get errors or wrong numbers.
Hope the following makes sense.
Here is my formula for the calculated column [Years Since Last Task]:
=IF (ISBLANK([Last Task Date]) && ([Current Role]<>BLANK()), DIVIDE([Quarters],4), FLOOR(1. * ( today() - [Last Task Date]) / 365, 0.25))
Problem: I am getting "114.25" for Ken....but I want a blank result instead. Meaning, I need to also filter out any name (row) who has a blank [Current Role]. How do
I add a filter to this current formula? Is one more step of filtering possible in this IF statement? (Maybe I shouldn't use an IF statement, and try CALCULATE instead?)
Below is the table 'Work' for you to see what's happening.
Name
Quarters
Last Task Date
Current Role
Years Since Last Task
John
1
1
0.25
Mike
4
2/7/2011
3
3
Todd
5
4/20/2009
4
5
Jeff
9/1/2013
3
0.5
Ken
0
114.25
Steve
2
12/3/2011
2
2.25
Nate
2
1/1/2014
2
0.25
Greg
1
8/11/2013
1
0.5
Ross
4
11/9/2010
4
3.25
Hope all this made sense. Let me know if you have any thoughts.
Thanks,
~UG1you can use nested IF-statements here:
=IF (ISBLANK([Current Role]),
BLANK(),
IF(ISBLANK([Last Task Date]),
DIVIDE([Quarters],4),
FLOOR(1. * ( today() - [Last Task Date]) / 365,0.25)
hth,
gerhard
Gerhard Brueckl
blogging @ http://blog.gbrueckl.at
working @ http://www.pmOne.com -
Creating a Status column (IF statement/calculated column)
I'm developing list for managing a project with 11 columns each representing a project milestone.
We'll call them A,B,C...K.
"A" representing a status of "Project Started" and K representing "Project Complete" with various statuses in between.
When a milestone has been reached, the date is input into the appropriate column. So when the project is complete, there will be dates in all columns A-K
I wish to incorporate a new column that indicates the current status depending on if columns A-K have been filled in.
So if all columns are blank, a status of "Awaiting start" is indicated.
If column A is filled in with a date, a status of "A" is indicated.
If columns A and column B are filled in then a status of "B" is indicated.
If columns A, B and C are filled in then a status of "C" is indicated. * * If all the columns are filled in with dates, a status of "K" is indicated.
Any ideas? Some form of If statement in a calculated Status column?Hello,
You can use nested if statement something like below.
For example, I have one column named as 'Score' and the requirement is to perform quartile breakup based on score so for that I can use below calculated formula in my calculated column.
=IF(INT(Score)>85,"85 Above"
,IF(AND(85>=INT(Score),INT(Score)>=80),"85-80"
,IF(AND(79>=INT(Score),INT(Score)>=75),"79-75"
,IF(INT(Score)<75,"Below 75","0"))))
Have below links for more details.
Calculated Field Formulas
Examples of common formulas
Thanks. Please mark it as an answer if it helped. -
Hi Everyone
I used this in SP calculated column field.
=IF([Shift Sched]="1pm to 10pm","0",IF([Shift Sched]="2pm to 11pm","1",IF([Shift Sched]="3pm to 12am","2",IF([Shift Sched]="4pm to 1am","3",IF([Shift Sched]="5pm to 2am","4",IF([Shift
Sched]="6pm to 3am","5",IF([Shift Sched]="7pm to 4am","6",IF([Shift Sched]="8pm to 5am","7",IF([Shift Sched]="9pm to 6am","8",IF([Shift Sched]="10pm to 7am","8",IF([Shift
Sched]="11pm to 8am","7",IF([Shift Sched]="12pm to 9am","6",IF([Shift Sched]="1am to 10am","5",IF([Shift Sched]="2am to 11am","4",IF([Shift Sched]="3am to 12pm","3",IF([Shift
Sched]="4am to 1pm","2",IF([Shift Sched]="5am to 2pm","1",IF([Shift Sched]="6am to 3pm","0",IF([Shift Sched]="7am to 4pm","0",IF([Shift Sched]="8am to 5pm","0",IF([Shift
Sched]="9am to 6pm","0",IF([Shift Sched]="10am to 7pm","0",IF([Shift Sched]="11am to 8pm","0",IF([Shift Sched]="12pm to 9pm","0"))))))))))))))))))))))))
it was able to work fine however my issue is when i extract the information to excel and use a pivot table the table is not able to calulate the sum of the value for this field. Can you please help me with this. this is for an Attendance traker for Night
Differential pay for employees. they create a daily log of their shift schedule and if i summarize this in pivot the value in the calculated field for this is not getting the sum.
Thanks,
NormanHi Everyone
I used this in SP calculated column field.
=IF([Shift Sched]="1pm to 10pm","0",IF([Shift Sched]="2pm to 11pm","1",IF([Shift Sched]="3pm to 12am","2",IF([Shift Sched]="4pm to 1am","3",IF([Shift Sched]="5pm to 2am","4",IF([Shift
Sched]="6pm to 3am","5",IF([Shift Sched]="7pm to 4am","6",IF([Shift Sched]="8pm to 5am","7",IF([Shift Sched]="9pm to 6am","8",IF([Shift Sched]="10pm to 7am","8",IF([Shift
Sched]="11pm to 8am","7",IF([Shift Sched]="12pm to 9am","6",IF([Shift Sched]="1am to 10am","5",IF([Shift Sched]="2am to 11am","4",IF([Shift Sched]="3am to 12pm","3",IF([Shift
Sched]="4am to 1pm","2",IF([Shift Sched]="5am to 2pm","1",IF([Shift Sched]="6am to 3pm","0",IF([Shift Sched]="7am to 4pm","0",IF([Shift Sched]="8am to 5pm","0",IF([Shift
Sched]="9am to 6pm","0",IF([Shift Sched]="10am to 7pm","0",IF([Shift Sched]="11am to 8pm","0",IF([Shift Sched]="12pm to 9pm","0"))))))))))))))))))))))))
it was able to work fine however my issue is when i extract the information to excel and use a pivot table the table is not able to calulate the sum of the value for this field. Can you please help me with this. this is for an Attendance traker for Night
Differential pay for employees. they create a daily log of their shift schedule and if i summarize this in pivot the value in the calculated field for this is not getting the sum.
Thanks,
Norman -
Calculated Column using IF statement with DATEIF formula
I have a dated column that includes a date when a position is vacated otherwise the field is blank if the position is still filled. I want a calculated column to return the number of days the position has been vancant from the date that is listed to today.
So the following was entered & works.....
=DATEDIF([Vacancy Date],Today,"d")
The delima is that it is also returning a value when there is no date in the dated column but it returns a funky number 42,069. What I want it to return when the dated column is blank is blank or zero would work too. I don't know how to incorporate that
into this formula.You are correct it no longer reads that column as Today.... So is there anyway to make this a calculated column for my purposes?
I'm going to use SharePoint list for a Position Pool & managing positions within a large department. What I'm attempting to do with this column is have a current count of the number of days since a position has been vacant. Our system that I pull the
position data from will give me the vacancy date for those positions & where the position is filled the date field will be blank. So I'm wanting this column to return a 0 when the position is listed as filled & the number of days vacant based on the
vacancy date column I have. Is there any way to make this work in SharePoint? Obviously I can make that work in Excel however my task was to load raw data into SharePoint & have SharePoint do the work if possible with little to no human intervention prior
to loading to SharePoint.
Thank you,
MMHagman -
Please Help!!!
How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column.
January 2014 January
2013 +/-
Region Entry Exit Total Entry Exit Total (Total of Jan2014-Total of Jan2013)
A 2 3
40 5 7 30 40-30= 10What is a table structure? Sorry cannot test it right now..
SELECT <columns>,(SELECT Total FROM tbl WHERE Y=2014)-(SELECT Total FROM tbl WHERE Y=2013)
FROM tbl
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
SQL*Loader-930: Error parsing insert statement for column
we upload data on daily basis in application throug apps user and these table are invloved
1. DEV_RA_INTERFACE_LINES_ALL(owner is a apps)
2.RA_INTERFACE_LINES_ALL(owner is a AR)
we do steps
1 delete record from DEV_RA_INTERFACE_LINES_ALL table
2 delete record from RA_INTERFACE_LINES_ALL table
3 load data using sql loader with apps user
4 insert in RA_INTERFACE_LINES_ALL table
we want to change user i mean these step do dataupload user not apps
we give the proper rights to dataupload like select,delete and insert rights on these table to dataupload user but when i going to load data throug sql loader we receive error
SQL*Loader-930: Error parsing insert statement for column APPS.DEV_RA_INTERFACE_
LINES_ALL.ORIG_SYSTEM_BILL_ADDRESS_ID.
ORA-00904: "F_ORIG_SYSTEM_BILL_ADDR_REF": invalid identifier
and if i insert data through apps then done.make sure that u have no speces left
between lines.
give the path of control file path correctly.
Maybe you are looking for
-
Input fields vanishing with mouseover
This bug seems to have started around FF14 and still persists to the latest version. In forms, all input fields will show as expected on page load. Then, when you move your mouse across the fields, some (but not all) will vanish and reappear, seeming
-
Remove underscore from buttons, add Alt text
Hi, Thanks in advance for your help. I am having more problems with the RH's Govt template. The forward and back buttons would not appear, so I have created my own buttons and incorporated into my user guide. However, there is an underscore appearing
-
Add characteristic WBS_ELEMENT
Hello All, i am executing this transaction S_ALR_87012168 in the screen i am entering some compnay code (say 7001) then when i execute the report....as there is navigation items on left side in which you can see entries like G/L account , customer,co
-
NFR 2.0 view reports timeout
I have NFR 2.0 running on a windows 2008 R2 server with 2CPU and 12GB ram. On this I've been trying to run some reports, though it seems as if larger reports fail. The report will generate, I can see it has been generated and created a file under "C\
-
Local member missing in report editor
Hi all, I have an input schedule (not developed by myself) where there are some local members. They carry formatting and formulas but are not visible in report editor. I'd appreciate any ideas where to start looking for them. Thanks, Madis