The Power BI VAR.P function is one of the DAX aggregate functions useful to calculate the variance of the entire population. This article explains the DAX VAR.P function that accepts the existing column (not the expression) to return the variance of the entire population and the syntax is as shown below:
VAR.P(<Column>)
The Power BI DAX VAR.P function works on the numeric values and assumes the column refers to the entire population. If it is the sample population, use the VAR.S.
- The VAR.P function uses the formula ∑(x – x˜)2 / n where x is the entire population. Next, x˜ is the average, and n is the size of the population.
- While calculating the variance of the entire population, the blank rows will be ignored and not considered in the calculation.
- This VAR.P function returns an error if the given column contains less than two non-blank rows.
Power BI DAX VAR.P function Example
We need a Measure to work with the VAR.P function and to assign the variance of the entire population. So, within the Home tab, click the New Measure button and rename it as SalesVARP. To demonstrate the Power BI DAX VAR.P() function, use the Sales column from the SuperStore Orders table to obtain the variance of the entire sales.
SalesVARP = VAR.P(Orders[Sales])
Please add the new SalesVARP Measure to the table report. Similarly, create two more measures to calculate the variance of the entire orders and profit. Please refer to the Aggregate and the function article for the remaining Power BI functions.
ProfitVARP = VAR.P(Orders[Profit])
OrdersVARP = VAR.P(Orders[Quantity])
Let me create three cards to display the variance of the entire population in the Sales, Orders, and Profit columns in one report. Next, add horizontal and vertical bar charts to show the entire population variance of the sales by sub-category, category, and profit VAR by country. You can click any report to see or highlight the population variance of them. For more Charts >> Click Here.