VAR.S

How to Use the Power BI DAX function VAR.S

Syntax of VAR.S Function

The syntax of the VAR.S function is as follows:


VAR.S(❰expression1❱,❰expression2❱,…)


Where:

- `❰expression1❱,❰expression2❱,...` are numeric expressions for which you want to calculate the variance.

Example of VAR.S Function

Let's say we have a table named "Sales" with two columns: "Region" and "SalesAmount". We want to calculate the variance of the sales amount for each region. Here's how we can use the VAR.S function to achieve this:


VAR RegionSalesVariance =

VAR SalesAmounts =

VALUES(Sales[SalesAmount])

RETURN

VAR.S(SalesAmounts)


In the above example, we first define a variable named "SalesAmounts" that contains all the distinct sales amounts from the "Sales" table. We then use the VAR.S function to calculate the variance of the sales amounts in the "SalesAmounts" variable. Finally, we assign the result to another variable named "RegionSalesVariance". This variable will contain the variance of the sales amounts for each region.

In conclusion, the VAR.S function in Power BI DAX is a powerful tool for calculating variance based on a sample of data. By using this function, you can quickly calculate the variance of numeric expressions in your data. So, if you want to perform variance analysis in your Power BI project, be sure to incorporate the VAR.S function in your DAX formulas.

Power BI DAX Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)