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

identify when values in a column change in spotfire

I am trying to create a calculated column that flags/counts the changes in values across rows in another column, in Spotfire. Below is an example of the data types I'm looking at and the desired results. My hope is that for each Location, and…
NightLearner
  • 295
  • 1
  • 7
  • 21
0
votes
2 answers

How to refer from a column to names of other columns and create a new column

I have a table such as +---------+---------+--------+--------+--------+ | Product | Classif | Type 1 | Type 2 | Type 3 | +---------+---------+--------+--------+--------+ | a | Type 1 | 2 | 6 | 8 | | b | Type 2 | 3 |…
0
votes
1 answer

Power BI how to calculate based on current material

I have a table 'Sales' where we capture all sales. We trade mainly on a 13 digit material number, where the last 3 digits define the country of manufacture. So we also maintain a 10 digit material number too, which defines the unique product. In…
0
votes
1 answer

Sum Column and Show repeated in an Extra Column

I need your help, I am a beginner in MySQL, I want to know the following, I add an image that shows a table, I need to know how to get the sum of the values of column A and show the result duplicate times in the column yellow which is called sum_A. …
0
votes
2 answers

Oracle sql date interval

Please help me B is correct? or C
0
votes
1 answer

Unable to apply datediff(d1,d2) if value flag in col1=1

In quicksight I want to calculate the Datediff only in the rows where value flag for cancellation=1(True) and add the output in new column on same row level, for row where cancellation=0, do not perform datediff My Quicksight query - this isn't…
0
votes
1 answer

Finding a value in a dataframe according to two columns from another data frame with R

I have a dataframe with two specific columns (weight and country) for each order. I have another dataframe giving all the possible combinations for weight and country, and their cost. I want to create a new column at the first data frame that gives…
0
votes
1 answer

Calculated Column to based on three other columns

I have trouble making calculated columns, still learning. I am trying to identify a pattern in one column based on Config type and time. So, for each Config type, I like to mark True next to any "Start" Events that experience "Error(s)" between the…
jmeddy
  • 109
  • 1
  • 5
  • 16
0
votes
2 answers

mySQL: Can I add a calculated column with the sum of all other rows that have that same shared value

I have a data set where each record includes street, zipcode, city, population. I want to find (% of population one zipcode is to the entire city's population) but can't figure out how to group by zip and then add a column that shows total city's…
Verm
  • 3
  • 1
0
votes
1 answer

Mysql calculate multiple SUM() varialbe

I want to calculate 2 sum() i have tried query as below it works but very slowly. Any ideas to make it better? SELECT customer, SUM(CASE WHEN book_day BETWEEN '2020-01-01' AND '2020-01-31' THEN pax+free …
0
votes
1 answer

Adding the calculated values to an empty column based on index stored in a variable using python

I am relatively new in programming and this is the first python code I have made. This is a code I used for calculation. I have managed to calculate the values and they can be seen in the variable "HT". But I am struggling with appending it to the…
0
votes
1 answer

how to perform count operation for a column with multiple values in Power BI?

So, let this be a dataset Column 1(text) | Column 2(text) textvalue1 | ab,bc,cd,de,ef textvalue2 | ab,bc textvalue3 | cd,de,zz,ns,ab textvalue4 | ab,bc,zz,de …
0
votes
1 answer

How to put standard error below estimate in a table in R, and transfer to flextable

I am creating a summary statistics table using the apistrat data with the output as a table in R (hoping to eventually format with flextable). I am hoping to manipulate the table so the standard error of each variable appears directly below the…
juliah0494
  • 175
  • 11
0
votes
2 answers

How to add a new column based on conditionnal difference between rows

I have a large dataset of ID of patients with delays in days between the surgery and radiotherapy (RT) sessions. Some patients may had two or three RT treatments. To identidy those patients, I consider a delay being greater than 91 days (3…
CharlesLDN
  • 169
  • 1
  • 9
0
votes
1 answer

Extract values from dictionary and conditionally assign them to columns in pandas

I am trying to extract values from a column of dictionaries in pandas and assign them to their respective columns that already exist. I have hardcoded an example below of the data set that I have: df_have = pd.DataFrame( { …