# Power Pivot Principles: The A to Z of DAX Functions – CHISQ.INV.RT

18 January 2022

*In our long-established Power Pivot Principles articles, we continue our series on the A to Z of Data Analysis eXpression (DAX) functions. This week, we look at CHISQ.INV.RT function.*

*The CHISQ.INV.RT function*

In probability theory and statistics, the chi-squared distribution (also chi-square or **χ2**-distribution) with **k** degrees of freedom is the distribution of a sum of the squares of **k** independent standard normal random variables. It is one of the most widely used probability distributions in inferential statistics, *e.g.* in hypothesis testing or in construction of confidence intervals.

The chi-squared distribution is used in the common chi-squared tests for goodness of fit of an observed distribution to a proposed theoretical one, the independence of two criteria of classification of qualitative data, and in confidence interval estimation for a population standard deviation of a normal distribution from a sample standard deviation.

If **Z _{1}**, ...,

**Z**are independent, standard normal random variables, then the sum of their squares

_{k}is distributed according to the chi-squared distribution with **k** degrees of freedom. This is usually denoted as

Thus, the chi-squared distribution has one parameter: **k** — a positive integer that specifies the number of degrees of freedom.

As aforementioned, the chi-squared distribution is used primarily in hypothesis testing. Unlike more widely known distributions such as the normal distribution and the exponential distribution, the chi-squared distribution is rarely used to model natural phenomena. It arises in the following hypothesis tests, among others.

The primary reason that the chi-squared distribution is used extensively in hypothesis testing is its relationship to the normal distribution. Many hypothesis tests use a test statistic, such as the **t** statistic in a **t-test**. For these hypothesis tests, as the sample size, **n**, increases, the sampling distribution of the test statistic approaches the normal distribution (**Central Limit Theorem**). Since the test statistic (such as **t**) is asymptotically normally distributed, provided the sample size is sufficiently large, the distribution used for hypothesis testing may be approximated by a normal distribution. Testing hypotheses using a normal distribution is well understood and relatively easy. The simplest chi-squared distribution is the square of a standard normal distribution. Therefore, wherever a normal distribution could be used for a hypothesis test, a chi-squared distribution could be used.

A chi-squared distribution constructed by squaring a single standard normal distribution is said to have 1 degree of freedom, *etc.*

The **CHISQ.INV.RT** function returns the inverse of the right-tailed probability of the chi-squared distribution. If probability = **CHISQ.DIST.RT(x**,...**)**, then **CHISQ.INV.RT(probability**,...**)** = **x**. Use this function to compare observed results with expected ones in order to decide whether your original hypothesis is valid.

The **CHISQ.INV.RT **function employs the following syntax to operate:

**CHISQ.INV.RT(probability, deg_freedom)**

The **CHISQ.INV.RT** function has the following arguments:

**probability:**this is required and represents a probability associated with the chi-squared distribution**deg_freedom:**this is also required. This denotes the number of degrees of freedom.

It should be further noted that:

- if either argument is nonnumeric,
**CHISQ.INV.RT**function returns an error - if
**probability**< 0 or**probability**> 1,**CHISQ.INV.RT**returns an error - if
**deg_freedom**is not an integer, it is rounded - if
**deg_freedom**< 1,**CHISQ.INV.RT**returns an error - this function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

Given a value for probability, **CHISQ.INV.RT** seeks that value **x** such that **CHISQ.DIST.RT(x, deg_freedom)** = **probability**. Thus, precision of **CHISQ.INV.RT** depends on precision of **CHISQ.DIST.RT.** **CHISQ.INV.RT** uses an iterative search technique. If the search has not converged after 64 iterations, the function returns an error.

*Example*

Inverse of the one-tailed probability of the chi-squared distribution for 0.050001, using 10 degrees of freedom. The result is 18.30697.

*Come back next week for our next post on Power Pivot in the **Blog** section. In the meantime, please remember we have training in Power Pivot which you can find out more about **here**. If you wish to catch up on past articles in the meantime, you can find all of our Past Power Pivot blogs **here**.*