# Chi2Test\_chi2 Script and chart function

Chi2Test\_chi2() returns the aggregated chi2-test value for one or two series of values.

If the function is used in the data load script, the values are iterated over a number of records as defined by a group by clause.

If the function is used in a chart expression, the values are iterated over the chart dimensions.

Information noteAll Qlik Sense chi2 -test functions have the same arguments.

Syntax:

Chi2Test\_chi2(col, row, actual\_value[, expected\_value])

Return data type: numeric

Arguments:

Arguments

| Argument | Description |
| --- | --- |
| col, row | The specified column and row in the matrix of values being tested. |
| actual\_value | The observed value of the data at the specified col and<br>row. |
| expected\_value | The expected value for the distribution at the specified col and<br>row. |

Limitations:

Text values, NULL values and missing values in the expression value will result in the function returning NULL.

Examples:

`Chi2Test_chi2( 
Grp, Grade, Count )     ` `Chi2Test_chi2( 
Gender, Description, Observed, Expected )  `

## Learn more

* [Examples of how to use chi2-test functions in charts](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/StatisticalTestFunctions/chi2-tests/chi2test-example.htm)
* [Examples of how to use chi2-test functions in the data load script](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/StatisticalTestFunctions/chi2Tests/chi2test-script-example.htm)