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
1 answer

Consecutive Positive or Negative calculation from data frame and filter results using R

I have the following dataset and looking to write a code that can help pull out which stocks have been positive or negative consecutively. The data would have first 3 column. last 2 columns are manually calculated in excel to depict expected…
A.B.
  • 83
  • 1
  • 8
0
votes
1 answer

Is there a way to group values based on remaining position?

I have different trades that I want to group by Entry date and Symbol. This is the Origin Data: (these are all values I get from the User) Date Time Symbol Ordertype Price Shares (Note for you) 01/01/20 09:30:00 ABC …
user11390995
0
votes
1 answer

Running equations by categories along a column in r

I currently have a dataframe that looks like this tree cookie height radius C1T1 A 0.37 12.3 c1t1 B 0.65 14.2 C1T1 C 0.91 16 C1T2 A 0.2 4 C1T2 B 0.5 10 C1T2 C 0.75 12.4 I would like to add a…
rrachel95
  • 43
  • 6
0
votes
2 answers

How to add new column using CAST and info from another table in SQL?

I'm trying to understand the relationship between two operations in SQL - ADD COLUMN and CAST(). I tried to create a new column containing the lengths of another column's values, while that other column is inconveniently of type INTEGER: ALTER TABLE…
Friedman
  • 189
  • 1
  • 1
  • 9
0
votes
1 answer

nested average over on AWS Quicksight

I have this dataset weekday hour id duration Sunday 1 1 20 Sunday 1 1 30 Sunday 1 2 10 I want to have average duration for weekday hour. The step is sum over the weekday, hour, id and then average…
0
votes
2 answers

Creating a New Column that Compared Two Other Columns in R

My data looks like: x y 2 5 3 6 4 2 6 1 7 10 12 16 145 1 Looking to output the number that's smaller than the other into a new column which would look…
0
votes
2 answers

Data recorded automatically and new column

I have a dataset containing the number of a products sold per day. However, the data is recorded in a strange way. So if the number of items sold passes 100, the recorder is reset and the number of items sold starts from zero. I have provided an…
H Hosseini
  • 43
  • 6
0
votes
1 answer

Create table with wilcox.test p values on multiple subgroup columns in R

I have df1 below. I would like to systematically calculate wilcox.test p values to test whether the variable is significantly higher/lower per color, as defined in the color1 and color2 columns. I would like to test this for all samples, and per…
Sylvia Rodriguez
  • 1,203
  • 2
  • 11
  • 30
0
votes
2 answers

Dax: calculate with filter and all, result not expected

I have a filter date table start from 2000/01/01 to 2020/1028 and a fact table of SP index. The model set as below: I use the this expression: firstDateYear2020 = CALCULATE ( MIN ( 'SP Index 20201028'[Date] ), FILTER ( ALL ( 'SP…
Li G
  • 1
0
votes
1 answer

Generate new column in R, keep value if it meets a condition, else use the previous column

I'm using R to generate two separate column vectors of length 20, and I want to add 150 additional column vectors to them and keep the new values based on values in previous columns. I initiate both column vectors using the code below: n <-…
0
votes
2 answers

How to count and compare number in datagirdview c#

I have labels "Hardwork" and 1 datagirdview display when load form. I use the code below to do the quantity comparison in the column "TotalTime". I want if the value is in column "TotalTime"> = 30 then labels "Harwork" + 1 but not run.the result is:…
Kevil
  • 71
  • 8
0
votes
1 answer

calculations in BigQuery returns E-4 SQL

I need to perform simple calculations in BigQuery and save the result in a new column. Below is my code: SELECT id, CPM, (1 / 1000000000 * CPM) AS Revenue FROM `big_query_table` For some numbers, it does the calculations right, but for other…
Chique_Code
  • 1,422
  • 3
  • 23
  • 49
0
votes
0 answers

Syntax error when trying to implement a computed column (GenCol) in SQLite (near "AS": syntax error")

I was trying to generate a computed column in SQLite and using this example as a reference. https://sqlite.org/gencol.html CREATE TABLE t1 ( a INTEGER PRIMARY KEY, b INT, c TEXT, d INT GENERATED ALWAYS AS (a*abs(b)) VIRTUAL, e TEXT…
stoltm
  • 1
  • 1
0
votes
2 answers

Calculate sum of last column in dynamically added rows using javascript

I have a table that a user can dynamically add a row as needed. I need to add a text box underneath the table that will dynamically output the total of the last column using JavaScript. If the calculations can't be done dynamically then I can add a…
0
votes
1 answer

Calculated Field in subreport

TL:DR I want a whole column of SQL equivalent of excel's COUNTIFS() Function. I'm still quite new to MS Access, but I'm quite proficient with Excel. I've inherited an Access Database that tracks reasons for delays in a large logistics group, and am…
Spencer Barnes
  • 2,809
  • 1
  • 7
  • 26