A calculated field (or calculated column) is a temporary (virtual) column which is generated by a query and contains the result of a calculation (i.e.: a price with VAT).
It only exists in the result set generated by the query.
Questions tagged [calculated-field]
728 questions
29
votes
2 answers
SQL - Calculate percentage on count(column)
I have the following piece of code which counts how many times something appears in the event column.
SELECT event, count(event) as event_count
FROM event_information
group by event
event event_count
a 34
b 256
c 45
d …

Dean Flaherty
- 351
- 1
- 5
- 15
16
votes
4 answers
How can I set up a simple calculated field in SQL Server?
I have a table with several account fields like this:
MAIN_ACCT
GROUP_ACCT
SUB_ACCT
I often need to combine them like this:
SELECT MAIN_ACCT+'-'+GROUP_ACCT+'-'+SUB_ACCT
FROM ACCOUNT_TABLE
I'd like a calculated field that automatically does this,…

JosephStyons
- 57,317
- 63
- 160
- 234
15
votes
4 answers
Google Data Studio: How to count number of specific events
I know similar questions were asked before, but none of the answers that I found (example here, another example) helped me.
What I am trying to do:
Create a report in Google Data Studio that shows me number of Unique Page Views VS Specific Event.…

Bruno Monteiro
- 4,153
- 5
- 29
- 48
15
votes
2 answers
Django Model Method or Calculation as Field in Database
Using Django ~=1.11 and Python 3.6
I need to store 'calculated' variables as fields in the Django model database.
Here's a model:
from django.db import models
from datetime import date
class Person(model.Model)
"Last Name"
last_name =…

Ron Raney
- 372
- 2
- 4
- 14
13
votes
5 answers
Adding a calculated field to a Query at run time
I'm getting data using a query in Delphi, and would like to add a calculated field to the query before it runs. The calculated field is using values in code as well as the query so I can't just calculate it in SQL.
I know I can attach an…

James
- 9,774
- 5
- 34
- 58
11
votes
7 answers
How can I implement "writable calculated" fields in a TDataSet?
I am in the need to add additional fields to a TDataSet that don't exist in the underlying database but can be derived from existing fields. I can easily do this with caclulated fields and that works perfectly.
Now I want to edit these fields and…

Uwe Raabe
- 45,288
- 3
- 82
- 130
11
votes
2 answers
Laravel sum eloquent collection
How can i sum a data set that has been eager loaded?
This is my table structure:
regions table
+------------+------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default |…

Lovatt
- 145
- 1
- 1
- 7
10
votes
3 answers
How do you use computed/calculated properties in Angular?
I am tormented by the question: where I should locate my calculated properties in angular project?
For example:
I have model, service to get model and component to show model.
person.model.ts:
export class Person {
firstName: string;
lastName:…

maskalek
- 453
- 5
- 18
10
votes
1 answer
Tableau count number of times same value appears in column
I have a field such that
Color
Pink
Blue
Pink
Blue
Pink
Pink
Pink
Pink
Pink
Blue
Blue
Pink
Pink
Pink
Blue
Pink
Blue
Pink
Blue
How to create calculated field to count number of times Pink appears?
Total numbers of Blue?

Rhonda
- 1,661
- 5
- 31
- 65
8
votes
2 answers
Ruby on Rails - before_save calculation on accepts_nested_attributes_for
I have an invoice model, that "has many" invoice items. I have a form that allows you to create/edit an invoice, and this form accepts nested attributes for the invoice items.
In my invoice model, there is a "total_amount" field that is a…

Joel Friedlaender
- 2,191
- 1
- 18
- 24
6
votes
1 answer
#NAME? Error with Google Sheets Pivot Table Calculated Field
I looked this issue up and did not find any sufficient solution for myself.
I am trying to create a Calculated Field through Google Sheets Pivot Tables and I'm getting the #NAME? error.
To my best understanding I'm following the steps given to…

Matt
- 239
- 2
- 9
5
votes
1 answer
Powershell piping an array of strings to ConvertTo-Html
For testing purposes (before I apply on my big code) I decided to pipe an array of string to convertTo-html hoping to create some kind of table displaying my array.
[String]$servers= @('GT544', 'HT54765', 'J4356', 'SW5654', 'JY67432')
psedit…

ZoneMeOut
- 113
- 3
- 8
5
votes
1 answer
Excel Pivot Tables - Calculated Fields How to Return Blank Cells
I'm working with pivot tables in excel and historical monthly returns for different mutual funds. I'm trying to calculate the historical monthly returns of each fund net of all management fees. So I have a series called 'MonthlyReturn' and one with…

gcefaloni
- 57
- 1
- 1
- 4
4
votes
0 answers
Find the length of an array / comma separated string values in Quicksight Calculated Field
I have a column of sent_to_emails in my Quicksight Dataset. I want to calculate the number of values in this comma separated string i.e. split the string based on a delimiter and then calculate the number of values returned in array.…

M.Zubair Akram
- 131
- 1
- 6
4
votes
1 answer
Firebird computed (calculated) field on server side
Newbie in SQL and development in general, I have a table (COUNTRIES) with fields (INDEX, NAME, POPULATION, AREA)
Usually i add a client side (Delphi) Calculated field (DENSITY) and OnCalcField :
COUNTRIES.DENSITY=COUNTRIES.POPULATION /…

Stalkium
- 148
- 1
- 11