Power BI DAX VAR.S Function

The Power BI VAR.S function is one of the DAX aggregate functions useful to calculate the variance of the sample population. This article explains the POWER BI DAX VAR.S function that accepts the existing column (not the expression) to return the variance of the sample population and the syntax is shown below:

VAR.S(<Column>)

The Power BI DAX VAR.S Function works on the numeric values and assumes the column refers to the sample population. If it is the entire population, use the VAR.P.

  • The VAR.S function uses the formula ∑(x – x˜)2 / (n – ) where x is the sample population. x˜ is the average of x, and n is the size of the population.
  • While calculating the variance of the sample population, it ignores the blank rows and does not consider them.
  • This VAR.S function returns an error if the given column contains less than two non-blank rows. Please refer to the Aggregate and the function article for the remaining Power BI functions.

Power BI DAX VAR.S function Example

We need a Measure to work with the VAR.S function and to assign the variance of the entire population. So, within the Home tab, click the New Measure button and rename it as SalesVARS. To demonstrate the Power BI DAX VAR.S function, use the Sales from the SuperStore Orders to obtain the variance of the sample sales. 

SalesVARS = VAR.S(Orders[Sales])

Please add the new SalesVARS Measure to the table report. Similarly, create two more measures to calculate the variance of the entire profit and orders. The other option is to add the Profit to the table. Next, click the down arrow beside it and change the aggregation to Variance as shown below. For more Charts >> Click Here.

ProfitVARS = VAR.S(Orders[Profit])

OrdersVARS = VAR.S(Orders[Quantity])
Power BI DAX VARS Function 1

Let me create three cards to display the variance of the sample population in the Sales, Orders, and Profit columns in one report. Next, add horizontal and vertical bar charts to show the sample population variance of the sales by sub-category, category, and profit VARS by country. You can click any report to see or highlight the sample population variance of them.

Power BI DAX VARS Function 2