Questions tagged [calculated-columns]

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

calculated-columns
Filter by
Sorted by
Tagged with
-4 votes
1 answer
221 views

Adding new column with data value in R

forest area to the I want to add a column name (say ForestAreaPerPopn) to find the ratio of forest area to the population(represented by variable Total below) residing. The data contains the ...
Prabhakar's user avatar
  • 161
2 votes
2 answers
1k views

Calculated column based on another calculated field BigQuery

Hello I'm trying to use an already calculated value in a select to calculate another value, for example: SELECT 1+1 AS two, ***two* + 2** AS four FROM table is this possible in BigQuery? I'm sure it'...
jrrodasm's user avatar
  • 101
1 vote
0 answers
37 views

How to index a specific column to perform field comparison calculations?

Given the following table: | A | B | holdingtemp1 | holdingTemp2 | holdingtemp3 | holdingTemp4 | idx | | Grits| 7:06:24 AM | 180.199 | - | - | - | ...
ericdwkim's user avatar
0 votes
1 answer
1k views

Sharepoint calculated if statement not working

I've done a lot of googling and no solution I've found works for me. Under the screenshot I have translated what it says. =IF(ISBLANK([ToDate]),"",[ToDate]-[DaysToWarn] This only throws an ...
Johanna Weidenius's user avatar
1 vote
1 answer
512 views

PowerBI : dynamic dimension in chart : calculated column does not update when input parameter is modified in slicer

pbix file : https://drive.google.com/file/d/1x6u9a1vamiWnaTgJY-yYTIpANlz2FXyn/view?usp=sharing I want to enable the user to do a simulation in PBI desktop. A color is associated to an ID depending on ...
vpvinc's user avatar
  • 155
0 votes
2 answers
15k views

Get sum of column values for specific rows only | Get sum of sales for each country

I am super new to power bi and Dax and i need to create a calculated column in which i have the total sales for each country respectively. Here is a screenshot with an oversimplified scenario but if i ...
Ortero's user avatar
  • 353
1 vote
4 answers
2k views

How to sum values in multiple rows to a new column in R?

My dataframe: structure(list(Observation = c("Apple", "Blueberry", "Cirtus", "Dates", "Eggplant"), Topic = 1:5, Gamma = c(0.1, 0.1, 0.2, 0.2, 0.1)), ...
md_14's user avatar
  • 135
0 votes
1 answer
418 views

create vector from for loop and append it as new column to data frame

I want to transform my data using method described in the picture below for that i want to create function that do this transformation, i created two for loops to pick all the values (first for loop ...
Reda's user avatar
  • 489
0 votes
1 answer
900 views

Measure inside Calculated Column; but measure depends on slicer selection

I have a tricky situation in Microsoft Power BI, and DAX language: I am developing a new Calculated Column called Status_CC in a table called Customers; we refer to this formally as - Customers[...
user3812887's user avatar
-1 votes
2 answers
117 views

how to find the percentage between 2 numbers with 2 conditions?

I'm having trouble finding the formula for percentages I have to calculate the employee bonus e.g. on April 8, 2022, we have 90.13% of the standard developed, the same on 04/04/2022 is 108.54% where ...
VoDAyToN's user avatar
1 vote
0 answers
43 views

add generated column with aggregated over a partion and sort

I am trying to add a calculated column that computes a rolling average of a sorted partition. I can make it work as a query but cannot seem to get the result to become a calculated field. ALTER TABLE ...
Nuljon's user avatar
  • 11
0 votes
2 answers
42 views

Calculating and Adding Several Columns to SQL results in only 1 row

I have a SQLite DB that has a table which has the following values: id Broker Stock Long_Short Stock_Price Shares_Owned 1 1 AMC Long 14.76 8 2 1 MSFT Short 282.36 8 3 1 AAPL Short 161.42 8 4 1 ...
acegay27's user avatar
0 votes
3 answers
55 views

how can i make two values ​in same column as separate columns in python

in this commands; import requests import pandas as pd url = "https://api.binance.com/api/v3/depth?symbol=BNBUSDT&limit=100" payload = {} headers = { 'Content-Type': 'application/...
Fatih Öztürk's user avatar
0 votes
2 answers
133 views

How to create a new column in a pandas df based on multiple conditions?

I am working on a programming assignment and am seeking some help out here as the course openly encourages us to. In the course of solving one of the problems, I need to find out from a dataset of ...
TropicalByron2's user avatar
1 vote
1 answer
1k views

Can't add a STORED column to MariaDB 10.7.3, Infamous "Error Code 1901"

I'm trying to add a GENERATED ALWAYS column to a table that will decode two characters into a DATE. It contains a function (returning DATE), but it was misbehaving the same way when the expression was ...
Jan Steinman's user avatar
1 vote
3 answers
70 views

Creating A New Calculated Category Within A Column in R

Suppose I have a data frame similar to this, only with 1000's of observations: df <- data.frame(Group = c('A', 'A', 'A', 'B', 'B', 'B','B','C','C','C','D','D','D','D','D')...
LowlyAnalyst's user avatar
0 votes
3 answers
1k views

Dynamically calculating total for each column based on selected rows for HTML table using Javascript

From the picture, I am trying to calculate the total of each column for the selected rows a and c. The code works if I unwrap it from the function calculateCols. Is it possible to make it work in ...
iuol's user avatar
  • 7
1 vote
1 answer
252 views

Alter column to make it a derived column

I'm learning PostgreSQL and I'm wondering is it possible to add a derived column to a table then ALTER it on a another line, I've tried different ways but I can't find the correct Syntax for it. For ...
coderoftheday's user avatar
1 vote
2 answers
130 views

Add share column based on year and other categorical variable to dataframe in R

I have sales data by year, condition and products Year <- c(2010,2010,2010,2010,2010,2010,2011,2011,2011,2011,2011,2011,2012,2012,2012,2012,2012,2012) Sale <- c("30","45",&...
Michael Carrasco's user avatar
2 votes
4 answers
71 views

Calculate Top N products by sales with in each year

I have the data about sales by years and by-products, let's say like this: Year <- c(2010,2010,2010,2010,2010,2011,2011,2011,2011,2011,2012,2012,2012,2012,2012) Model <- c("a","b&...
Michael Carrasco's user avatar
0 votes
1 answer
276 views

Calculate Top N products by sales and years

I have the data about sales by years and by-products, let's say like this: Year <- c(2010,2010,2010,2010,2010,2011,2011,2011,2011,2011,2012,2012,2012,2012,2012) Model <- c("a","b&...
Michael Carrasco's user avatar
0 votes
1 answer
54 views

How do I check if a column is calculated from other columns in a dataframe?

my data frame is named daily_activity and the columns are TotalDistance, ActiveDistance, ModeratelyActiveDistance, LightActiveDistance, and SedentaryActiveDistance if daily_activity['TotalDistance'] ==...
Black_IG's user avatar
1 vote
1 answer
143 views

Calculate the percentage of a column

I have loaded an Excel sheet into Tableau: File_name, Category A, CCCCC A, CCCCC B, CCCCC C, EEEEE D, EEEEE E, WWWW F, WWWW I need to calculate: what percentage of Files are in Category CCCCC? In this ...
Little_Tomato's user avatar
1 vote
1 answer
1k views

Entity Framework HasComputedColumnSql method returns an error

I am trying to add computed column to my model by adding new readonly property to my entity and using HasComputedColumnSql method in the Context class. However this results in a SqlException with ...
KiNest's user avatar
  • 55
0 votes
1 answer
49 views

How to calculate the persondays in a year based on two date columns

I would like to count the amount of days an ID/row(person) has during a period of 1 year. Below an example of my dataset. (Inschrijfdatum = registration date, Uitschrijfdatum = deregistration date) ...
RvS's user avatar
  • 169
0 votes
1 answer
1k views

Pandas calculating sales for recurring monthly payments

I have a dataset with millions of records just like below CustomerID StartTime EndTime 1111 2015-7-10 2016-3-7 1112 2016-1-5 2016-1-19 1113 2015-10-18 2020-9-1 This dataset contains the ...
Rose's user avatar
  • 1
0 votes
2 answers
1k views

calculate new column values based on conditions in pandas

I have columns in the pandas dataframe df_profit: profit_date profit 0 01.04 70 1 02.04 80 2 03.04 80 3 04.04 100 4 05.04 120 ...
serg's user avatar
  • 3
1 vote
3 answers
117 views

How to create and populate pandas columns based on cell values

I have created a dataframe called df as follows: import pandas as pd d = {'feature1': [1, 22,45,78,78], 'feature2': [33, 2,2,65,65], 'feature3': [100, 2,359,87,2],} df = pd.DataFrame(data=d) print(df) ...
Giampaolo Levorato's user avatar
0 votes
1 answer
326 views

How to get all months as a date from a start & end date in DAX

im working on a calculated column in a SSAS model. My Idea is to generate every month as date ( f.e 2021-01-01) based on a start and end date, who are also columns of that entry. Basically i wanna ...
Robert Di Meglio's user avatar
1 vote
3 answers
204 views

R - Adding calculated columns to a table using existing names of a numeric vector and existing data

Hi I've got a table (data1) and a numeric vector(quantile) and trying to append calculated columns using the existing data (data1) and the vector(quantile). such that: newcol_20% = col1 + col2 + 20%, ...
Naomi's user avatar
  • 67
0 votes
1 answer
470 views

Create pandas column based on conditional data in current or other df columns

If I have two dataframes, as below. df_1: id id_type 100 atype 101 atype 102 atype 603 another 604 another 605 another and df_2: id_1 id_2 id_3 100 600 200 101 601 200 102 602 200 103 ...
lte__'s user avatar
  • 7,438
0 votes
1 answer
30 views

Pandas: How to create a new column that adds selected columns across rows

I would like to create a new column called "Excess Return" that is =('SPX TR'-'3M Govt'), and I want to place it to the right of the '3M Govt' column. How do I do that? Please call the ...
Peiyu Xiong's user avatar
0 votes
1 answer
3k views

PowerBi - How to show multiple total columns in Matrix?

I have a slicer from which I can select weeks that I want to show on a matrix. Currently, the matrix only shows the total column at the end of all columns basically summing up all the values. But I ...
Bilal Shafqat's user avatar
0 votes
1 answer
1k views

Mean calculation from dataframe columns with pyspark

I'm looking for solution how to do following calculation without conversion from spark df to pandas df: mean = sum(df[A]*df[B])/sum(df[B]) Calculation based on selected columns in spark dataframe can ...
ahonemat's user avatar
0 votes
1 answer
2k views

How can I create a new column in R with a count of observations in another column in the dataset?

I have a dataset in R with information about individuals and diagnoses. The variables are group, age, weight, id and diagnosis. So an individual can have one row with X in diagnosis (meaning no ...
user18622113's user avatar
-1 votes
1 answer
178 views

How can I calculate a column by different values and sum it at the same time?

Situation: We have tableA with columns: Date, UniqueID, ClientID, Value Requirements: Pull out data from TableA for: A1) Year today (without using explicit dates) B) Sum the Commission and ...
melis16's user avatar
0 votes
1 answer
168 views

How to calculate the bimester of the year?

a question how can I create a column based on a date that tells me to which bimester of the year it belongs? For example, with this function I calculate the quarter, but I have not been able to ...
consultor12325's user avatar
0 votes
1 answer
2k views

One count DAX for multiple columns that contains same values but in unorganised order, connected to rows

Hopefully I can make myself understood, we are doing a research on NPS (Customer satisfaction from 1 to 10 (1 sad and 10 happy) ). We use Quicksearch and have exported the raw data to PowerBI. Every ...
Fraita's user avatar
  • 73
1 vote
1 answer
2k views

How do you change the default calculated column formula in an Excel list table?

I have a list with a column that did a lookup to another sheet in the workbook. The original formula looked like this: =VLOOKUP([@[Last Name]]&" "&[@[First Initial]],LookupLastF,9,...
Gabrielle's user avatar
0 votes
2 answers
451 views

Pandas - Create Column on the fly based on condition

Suppose that I have a data frame as below +------------+-------+ | Date | Price | +------------+-------+ | 25/08/2021 | 30 | | 24/08/2021 | 20 | | 23/08/2021 | 50 | | 20/08/2021 | 10 ...
Lopez's user avatar
  • 342
0 votes
1 answer
2k views

Creating a new column equals the logarithm of another column in R

As titled.I tried to create a new column called level_log by taking the logarithm of an existing column named "level" I tried: chol$level_log <-chol$log(level) But it shows: Warning: ...
Alex's user avatar
  • 81
0 votes
0 answers
43 views

how to use dax filter to condition on column?

i want to add another column which is the count of enrolled in the same month and register on same month where IsEnrolled - Enrolled students RegisteredOn - date of Registration on website where R-M ...
Shubham Londhe's user avatar
0 votes
0 answers
461 views

groupby with transform and lambda: faster alternative?

I have a dataframe that contains 100,000 products and their time series (row-wise, not 100,000 columns). I need to calculate 40 columns that offer various time lags, differences, or rolling averages ...
kerfuffle's user avatar
1 vote
1 answer
246 views

SQL : duplicate columns with NULL values

I'm trying to get the number of quantities per month and per application taking into account a weighting: SELECT jan.app_name, fev.app_name, jan.api, fev.api, jan.user_id, fev.user_id, qt_janvier, ...
Alex's user avatar
  • 59
0 votes
1 answer
161 views

How Calculate Average Daily Variation in R?

I have a dataframe # Create a, b, c, d variables a <- c("06-25-20 08:00:00 AM","06-25-20 08:15:00 AM", "06-25-20 08:30:00 AM","06-25-20 08:45:00 AM", ...
Kristen Cyr's user avatar
3 votes
1 answer
226 views

Every New Value in a Column to Automatically Multiply by X

In a spreadsheet, I am trying to somehow make it so any new numerical value that gets inputted into a cell in column D to multiply by 85%. Basically, if I go to any cell 2-100,000 in column D and ...
danklok's user avatar
  • 33
0 votes
0 answers
64 views

problem on showing calculated value in django formsets field using javascript

I am trying to calculate the total value using the quantity and rate. Once the user enters it in the field and shows it in amount field. The field disappears after entering a value rather than showing ...
lightyagami's user avatar
1 vote
1 answer
35 views

SQL server Computed column giving in-correct result

Following SQL Statement returns NULL in MP_SALESID. However if I replace where KRFPRODUCTIONORDERGROUPiD = 'T1.KRFPRODUCTIONORDERGROUPID' with an actual value for T1.KRFPRODUCTIONORDERGROUPID then I ...
HMD's user avatar
  • 15
0 votes
1 answer
469 views

Rows of one column shifting under other column in Pandas after str.split?

I'm cleaning data (from a csv file) in Pandas and one of the columns pic of it's first 4 rows has hundreds of values (in each row) seperated by comma. I use str.split(',', expand=True) and able to get ...
Vaibhav's user avatar
1 vote
1 answer
4k views

Determine if 2 date columns are <= today and <= end of the next month in Power BI / DAX measure with IF statement

I have 2 columns that includes 2 different dates. What i'm trying to do is to create a calculated column that determines whether column "governance" is <= TODAY and the "contract ...
Mido's user avatar
  • 11

1
5 6
7
8 9
46