DVar() and DVarP() Functions MS Access
Last Updated :
23 Sep, 2020
1. DVar() Function :
DVar() Function in MS Access is used to estimate variance across a set of values in a specified set of records (a domain). DVar function evaluates variance across a population sample.
Syntax :
DVar (expr, domain, criteria)
Parameters :
This method accepts three-parameter as mentioned above and described below :
- expr : It identifies the field for which we want to find the variance. It can be a string expression identifying a field in a table or query, or it can be an expression that performs a calculation on data in that field.
- domain : It identifies the set of records that constitutes the domain. It can be a table name or a query name for a query that does not require a parameter.
- criteria : It identifies a string expression used to restrict the range of data on which the DVar function is performed. It is optional. It is the WHERE clause to apply to the domain.
Returns : If domain refers to fewer than two records or if fewer than two records satisfy criteria, the DVar functions return a Null, indicating that a variance can't be calculated. Otherwise, it returns the variance across a population sample.
Table – ProductSales :
Product_Id |
Product_Price |
101 |
10000 |
102 |
11000 |
103 |
12000 |
104 |
13000 |
Example-1 : Variance of the product price.
SELECT DVar("Product_Price", "ProductSales") AS DVar_Value ;
Output :
DVar_Value |
1666666.6666667 |
Example-2 : Variance of the product price whose price is less than 12500.
SELECT DVar("Product_Price", "ProductSales", "Product_Price<12500") AS DVar_Value ;
Output :
2. DVarP() Function :
DVarP() Function in MS Access is used to estimate variance across a set of values in a specified set of records (a domain). DVarP function evaluates variance across a population.
The main Difference between Dvar and DvarP is that DVarP function evaluate variance across a population and the DVar function evaluates variance across a population sample.
Syntax :
DVarP (expr, domain, criteria)
Parameters :
This method accepts three-parameter as mentioned above and described below :
- expr : It identifies the field for which we want to find the variance. It can be a string expression identifying a field in a table or query, or it can be an expression that performs a calculation on data in that field.
- domain : It identifies the set of records that constitutes the domain. It can be a table name or a query name for a query that does not require a parameter.
- criteria : It identifies a string expression used to restrict the range of data on which the DVarP function is performed. It is optional. It is the WHERE clause to apply to the domain.
Returns : If domain refers to fewer than two records or if fewer than two records satisfy criteria, the DVarP functions return a Null, indicating that a variance can't be calculated. Otherwise, it returns the variance across a population.
Notes : In DVar or DVarP function, values are calculated before data is grouped and in Var or VarP function, the data is grouped before values in the field expression are evaluated.
Table - ExamDetails :
Sub_Id |
Marks |
1 |
88 |
2 |
95 |
3 |
96 |
4 |
100 |
Example-1 : Variance of Marks.
SELECT DVarP("Marks", "ExamDetails ") AS DVarP_Value ;
Output :
Example-2 : Variance of the marks which are >90.
SELECT DVarP("Marks", "ExamDetails ", "Marks>90") AS DVarP_Value ;
Output :
DVarP_Value |
4.6666666666667 |
Similar Reads
DMin and DMax Functions MS Access
1.DMin() Function : DMin() Function in MS Access is used to determine the minimum values in a specified set of records (a domain). The DMin functions return the minimum values that satisfy the criteria. If expression identifies numeric data, the DMin functions return numeric values. If expression id
3 min read
DSum() and DAvg() Functions MS Access
In Microsoft Access, domain aggregate functions like DSum() and DAvg() provide a powerful way to calculate summaries of data across tables or queries. These functions allow users to perform calculations dynamically based on specific criteria, making them particularly useful in forms, reports, and qu
4 min read
Chr() and Asc() Function in MS Access
1. CHR() Function : The Chr() function returns the character for the given ASCII number code. The Chr function takes an integer as a parameter and returns the respective character. It works opposite to ASC() function. Syntax - Chr(ASCII number code) Parameter - Required; An integer. Return - A chara
1 min read
Atn() and Cos() Function in MS Access
Atn() Function : In MS Access, The Atn() function returns the arctangent of a number. It takes a number as a parameter and it will return the arc tangent of that number. It will help to perform the mathematical operation of trigonometry. Syntax : Atn(number) Example1 - SELECT Atn(50) AS AtnNum; Outp
1 min read
DateDiff() and DatePart() Function in MS Access
The DateDiff() function in MS Access calculates the difference between two dates and returns the result in specified time intervals, such as years, months, or days. The DatePart() function extracts specific components of a date, like a year, month, or day, allowing for detailed analysis and manipula
4 min read
DateSerial() and DateValue() Function in MS Access
In this article, we are going to cover DateSerial() and DateValue() Function in MS Access with examples and will cover DateSerial and DateValue query with output. DateSerial() Function : The format of the DateSerial functions contains three parts year, month, and day values. And it returns date in a
2 min read
Abs() and Avg() Function in MS Access
1. Abs() Function : In MS Access, the abs() function returns a positive (absolute) number. In this function, either a positive number or a negative number is passed, and it returns the absolute of that number. It takes a number as a parameter and it returns the positive value of that number. Syntax
1 min read
Day() and Hour() Function in MS Access
1. Day() Function : Day() function returns the day of the month for a given date. In this function, it will take a date as a parameter and it will return the day of that date. The returned day will between 1 to 31. Syntax : Day(date) Example-1 : SELECT Day(#02/23/2020#); Output - 23 Example-2 : SELE
1 min read
Exp() and Count() Function in MS Access
In MS Access, functions like Exp() and Count() play vital roles in data manipulation and analysis. The Exp() function is used for mathematical computations, specifically to calculate the exponential value of a number, where e (approximately 2.718) is raised to a specified power. In this article, We
3 min read
Fix() and Format() Function in MS Access
1. Fix() Function : In MS Access, the fix() function returns the integer part of a number. In this function, a number will be pass as a parameter and it will return the integer part of that number. Syntax : Fix(number) Example-1 : SELECT Fix(-75.43) AS FixNum; Output - FixNum -75 Example-2 : SELECT
2 min read