Questions tagged [calculated-columns]

A calculated column is calculated from an expression that can use other columns in the same table

A calculated column is calculated from an expression that can use other columns in the same table. The expression can be a noncomputed column name, constant, function, and any combination of these connected by one or more operators. The expression cannot be a subquery.

2235 questions
0
votes
2 answers

How do I create a new variable with values that base on the difference between two time points?

I have two variables that represent the wake-up time and go to sleep time in minutes (example: If Person A went to bed at 00:40 it would be "40" for sleep_min). id day wake_min sleep_min 1 ADD15 1 518 40 2 ADD15 2…
0
votes
2 answers

Row calculations in matrix with anchored internal reference in R

I have a matrix and I would like to perform a calculation on each number in the matrix so that I get another matrix with the same dimensions only with the results of the calculation. This should be easy except that part of the equation is dependent…
0
votes
2 answers

Calculations within a matrix with internal, references that are anchored to columns within the matrix in R

I have a matrix and I would like to perform a calculation on each number in the matrix so that I get another matrix with the same dimensions only with the results of the calculation. This should be easy except that part of the equation is dependent…
0
votes
1 answer

Calculating rows in a table for every Quarter in DAX, Power BI

I have the following tbl_Episodes table (50K records): ID Month 22 01/01/2019 22 02/01/2019 22 03/01/2019 22 04/01/2019 22 05/01/2019 23 03/01/2020 23 06/01/2020 I need to create a…
Hell-1931
  • 489
  • 1
  • 6
  • 24
0
votes
2 answers

Creating calculated field with subquery in oracle

so I'm new to Oracle SQL and am trying to create a calculated column using a subquery. It seems like this information shouldn't be so hard to find but I haven't been able to find it... I would really appreciate any guidance! SQL> CREATE VIEW…
Erin
  • 465
  • 4
  • 11
0
votes
3 answers

Adding a new column to an existing table based on the contents of two preexisting columns

I am trying to add a new column to an existing table in SQL Server. I want this new column's value to be determined based on the contents of two existing columns within the table. For example there is one column called manufacturer and another…
Jiuthai
  • 11
  • 2
0
votes
0 answers

Problem while adding a derived data column

CREATE TABLE tl ( joining_date date, experience int GENERATED ALWAYS AS (case when joining_date is not null then age (current_date, joining_date) ) STORED ); I'm getting an error here, anyone knows what is the problem here. Note: I'll close this…
0
votes
1 answer

Common Pandas approaches to adding a new column and finding percentage of group total

Steadily shifting my tasks from excel to pandas, what are some common methods used when creating a new column that relies on a grouping and a value of two other columns? In excel this could be done with a =B2/SUMIFS(B:B,A:A,A2) -- are there…
0
votes
1 answer

Time Difference Calculation on SAP HANA Cloud

I want to calculate the difference between Occurence_TimeStamp and Response_TimeStamp using a calculated column. I have used SECONDS_BETWEEN("Occurence_TimeStamp", "Response_TimeStamp") to convert the difference in seconds. The challenge I am facing…
Akby
  • 23
  • 1
  • 5
0
votes
0 answers

Getting computed column filled in EF Core on every call to entity

I am using code first with Entity Framework in my ASP.NET Core application. I am using a generic repository for crud operations. I have a base audit class which is inherited by all entities in my dbcontext. public class Audit_base { public…
0
votes
1 answer

for loop stopping prematurely without covering all the items in the reference list

I am working on analyzing a housing dataset and it has temporal (year) features whose effect on the target variable (SalePrice) is what I am trying to visualize separately. The way I am doing this is finding the delta of other year features and the…
0
votes
2 answers

Specifying where columns should be placed in r

When I create a new variable, is there a way to specify in the function where to place it? Right now, it adds it to the end of the dataframe, but for ease of viewing in Excel for example, I'd like to place a new calculated column beside the columns…
Pre
  • 111
  • 7
0
votes
1 answer

What is the data type returned for an IF function (SharePoint Calculated Column)?

I have a rather long calculated column which uses the drop-downs of two other columns to return a 'score' based on their values. A section of it looks like this: IF(AND([Current Impact]="High",[Current Probability]="Low"),17) This would return the…
0
votes
1 answer

Defining new variable from Subquery - Only scalar expressions are allowed. (SQL Server)

I'm trying to add a column [Missed 2x] to an existing table that indicates whether the Subject has had two consecutive missed diaries. The value is "Missed 2x" if the most recent 2 diaries are missed, and NULL otherwise. I wrote a select statement…
0
votes
1 answer

Entering systematically new columns to a dataset with month/year reference to existing column

My current data is looks roughly like this barcode Jan-18 Feb-18 Mar-18 Apr-18....... 11 100 150 200 250 22 500 600 700 800 33 900 1000 1100 1200 now I just need to add to every date…