FAQ Database Discussion Community


I need a query multiple columns each date in same table

mysql,multiple-columns,calculated-columns
I have this table structure Date | Success | No of success tran.| Failed | No. of failed tran 29/05/2015 | Total Amount | count success tran.|total amount| count failed tran I want "Date" to have datetime. "Success" to have total sum of success amount. "Number of success transactions" to...

Does Persisted Computed Column need to update all rows or just affected rows?

sql-server,performance,sql-server-2008-r2,calculated-columns
In this Stackoverflow article, I understand what Persist mean and their advantages and disadvantages. However, I tried to research deeper but cannot find about the "update" one. Here is my scenario (TL;DR version below): I have Order table and OrderDetail table, as in this diagram: The OrderDetail.Subtotal is a computed...

MySQL Custom calculate views

mysql,sql,database,views,calculated-columns
I am having difficulty trying to combine a set of queries I am using. I currently am having to execute multiple queries with different years and CID numbers. (CID is 1-5, Years are CurrentYear to CurrentYear-6) Current SQL Statement: SELECT 1 as CID, 2015 as `Year`, ( SELECT SUM( legacy_reports_payments.AmountPaid...

Formula for a calculated field to convert string to date()in share point

sharepoint-2010,calculated-columns,date-calculation
we have a list where the date is saving as YYYY-MM-DD format in a column of single of text. Now i need a formula for calculated column of Date type to save the string date(YYYY-MM-DD) to DD-MM-YYYY of date type. any help or suggestions please.....

Sharepoint Calculated Column If Statement Evaluation

sharepoint-2010,calculated-columns
I have a calculated column that always evaluates to true even when it should and I can't figure out why. Any help would be greatly appreciated, here is the column: =[Name]&" "&IF([num1]>0,"("&[num1]&")","")&" "&IF([num2]>0,"("&[num2]&")","") So I it should show num1 if it is > 0 and num2 if that is >...

SQL Using row data from one table to choose data from a specific column in a different table

sql,sql-server,calculated-columns
I have one table with row data that matches column names in a different table as such: Items: ProdName ProdNum Quality Type Price Teddy Bear 123 Low Toy 5 Airplane 234 High Toy 20 Monopoly 345 Mid Game 15 Chess 456 High Game 20 Tax Bracket: Type Low Mid High...

Converting Julian Date (5 or 4 character) to Gregorian and vice versa

excel,excel-vba,math,excel-formula,calculated-columns
I'm trying to create a VBA script or a formula/function that converts a Julian Date (5001 or 15001) to a regular date (01/01/2015). I was able to find the following formula that converts a 5 character Julian Date to Gregorian Date and it works fine. I'm no mathematician so I'm...

SharePoint 2013 Calculating Scores

if-statement,sharepoint-2013,calculated-columns
I am working in SharePoint 2013. I am trying evaluate the work of my staff and will be using a list to track this and want to assign a grade to the results. If the person gets a 4 out of 5 I want them to receive 80%. The way...

DAX for MAX of a group

visual-studio-2012,max,powerpivot,calculated-columns,dax
I have two data columns: Record | Record Version ------------------------ 1 | 1 1 | 2 1 | 3 2 | 1 2 | 2 2 | 3 2 | 4 3 | 1 3 | 2 3 | 3 4 | 1 4 | 2 4 | 3 4...

Counting the number of columns greater than 0 for each row in sql server 2012

sql-server,count,sql-server-2012,calculated-columns
I have a table with more than 150 columns. is there any way to dynamically count columns greater than 0 for each customer. table view is like : CustomerID (SomeColumns) Coulumn1 Coulumn2 ------------------Column150 1 ----- 0 12 0 33 0 18 97 2 ----- 1 0 54 0 72 0...

Calculated column in SQL with IF-ELIF-ELSE condition

sql,sql-server,table,if-statement,calculated-columns
Dear Stackoverflow users, I need help on how to calculate this calculated column in SQL-code. I have seen earlier in the forum how you calculate based on adding columns together, or just giving a standard value. But in my case, I would like to add a column that could show...

create new column based unique values

r,calculated-columns
Say I have a simple dataset of this set.seed(123) a <- sample(1:4, 30, replace = TRUE) b <- sample(5:10, 30, replace = TRUE) c <- sample(5:15, 30, replace = TRUE) data <- data.frame(a,b,c) Now I want to create a new column, data$d which will take the values of b when...

create and fill columns in dataframe in R

r,for-loop,data.frame,calculated-columns
Apologies if this is basic question. I'm a novice. Any directions are much appreciated. I have df1 as below (POSIXct) (135 rows) > head(df1) uniqueSessionsIni uniqueSessionsEnd 1 2015-01-05 15:00:00 2015-01-05 15:59:00 2 2015-01-05 15:00:00 2015-01-05 15:59:00 3 2015-01-05 15:00:00 2015-01-05 15:59:00 vector names - with names for the new 600...

Summing columns in two tables then joining tables

sql,join,calculated-columns,proc-sql
I have two tables set up in the same way, but with different values. Here are samples from each: Table1: Date Code Count 1/1/2015 AA 4 1/3/2015 AA 2 1/1/2015 AB 3 Table2: Date Code Count 1/1/2015 AA 1 1/2/2015 AA 0 1/4/2015 AB 2 I would like the result...

Subtracting Columns in R

r,row,calculated-columns
I have two columns I am trying to subtract and put into a new one, but one of them contains values that read '#NULL!', after converting over from SPSS and excel, so R reads it as a factor and will not let me subtract. What is the easiest way to...

Simple Enquiry with Complex Answer - How do I Select RowA6-Row(last non-blank) for a simple formula

excel,excel-vba,cell,calculated-columns,calculated-field
I have many columns all labeled with many many values underneath, which can be words or numbers Here is the current equation =INDEX(AK6:AK94,MODE(MATCH(AK6:AK94,AK6:AK94,0))) I have this on the in cell 5 of each column. The number of values in each column may increase or decrease. If i reference the entire...

Python Pandas sum of dataframe with one column

python-2.7,pandas,sum,dataframes,calculated-columns
I have a Python Pandas DataFrame: df = pd.DataFrame(np.random.rand(5,3),columns=list('ABC')) print df A B C 0 0.041761178 0.60439116 0.349372206 1 0.820455992 0.245314299 0.635568504 2 0.517482167 0.7257227 0.982969949 3 0.208934899 0.594973111 0.671030326 4 0.651299752 0.617672419 0.948121305 Question: I would like to add the first column to the whole dataframe. I would like...

I can't change two main Bootstrap columns altogether (col-sm-4 & col-sm-8)

css,twitter-bootstrap,calculated-columns
I have two main columns in a bootstrap website. The first is the side-bar column and the second is the main content column. In Desktop they appear fine but in Mobile the sidebar doesn't go under the main-content area. You could see a live example for this in one of...

Unpivot table and calculate field

sql-server-2008,date,calculated-columns,unpivot
I have a bad schema and need to unpivot some fields and also calculate a date. Here's what I have: DATE1 DATE7 H1 H2 H3 H4 H5 H6 H7 2011-09-19 2011-09-25 3 5 2 7 8 0 0 2011-09-26 2011-10-02 8 6 4 2 1 0 0 2011-10-03 2011-10-09 7...

conditional replace based off prior value in same column of pandas dataframe python

python,pandas,replace,fill,calculated-columns
Feel like I've looked just about everywhere and I know its probably something very simple. I'm working with a pandas dataframe and looking to fill/replace data in one of the columns based on data from that SAME column. I'm typically more of an excel guy and it is sooo simple...

spotfire: search a column of another table

search,calculated-columns,spotfire
I'm trying to make a calculated column in Spotfire, where a specific value has to be present in a column of another table before a new value is assigned. My expression looks like this: If(Find('Specific value first table',**'present in second table'**) is Null, 0, 'New Value') I have no idea...

Python: create a new column from existing columns

python,pandas,missing-data,calculated-columns
I am trying to create a new column based on both columns. Say I want to create a new column z, and it should be the value of y when it is not missing and be the value of x when y is indeed missing. So in this case, I...

Weighted-Avg Access Query

sql,ms-access,calculated-columns,weighted-average
Background: I have the following table with clothing brand names, the count of the brand name sold, the revenue the brand name has brought in, and an avg per unit sold of that brand name. Quantity Brand Revenue Rev_Per_Brand 1820 CMD $13,519.50 $7.43 791 ATL $8,997.00 $11.37 335 WHBM $4,988.00...