Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
AjinMi
Regular Visitor

Standard deviation across columns

How to calculate standard deviation of reading like standard deviation of reading 1, reading 2 etc in DAX

Screenshot_20210710-085542_Excel.jpg

 

6 REPLIES 6
daxer-almighty
Solution Sage
Solution Sage

I'm not sure why you would want to calculate stdev for rows (across columns). If you want to do it, you have to change the model and arrange your data in such a way that your rows become columns (columns become rows) and then you can use the standard function of DAX, STDEV.S – DAX Guide. Functions in DAX are designed to work with columnar databases (which PBI uses behind the scenes), not row data.

 

If you really insist, you can do it but it'll be a very messy formula and not dynamic. Not recommended at all.

 

The proper way is to just transform the data into:

 

table T:

reading, value

reading1, 1

reading1, 2

reading1, 1

...

reading2, 1

reading2, 4

...

 

Once you've got this data (which will accomodate any number of "your columns" dynamically) it's dead easy to do it. This measure will do it: [STD] = STDEV.S( T[Value] ). When you start slicing by the reading column, you'll get the stdev for each and every reading across the columns in your original table.

But how to do if I need std across particular columns.

Transform the model accordingly or... you'll have to type the usual formula by hand using the column names. I told you it's tedious and in my view incorrect. If you are creating a calculated column, you'll have to do something like:

 

 

var Mean_ = ( T[Col1] + ... + T[ColN] ) / N
var Var_ = ( ( T[Col1] - Mean_ )^2 + ... + ( T[ColN] - Mean_ )^2 ) / ( N - 1 )
return
    Var_^(0.5)
 
// You know that you'll have to write out
// all the columns in the above formula
// and replace the "...", right? Told you
// it would be tedious and not scalable...

 

AjinMi
Regular Visitor

Iam asking for powerbi only, as I mentioned DAX

I want to calculate Standard deviation horizontally of particular columns

 

daxer-almighty
Solution Sage
Solution Sage

Is this a question about DAX or Excel? I think you've posted the message on a wrong forum...

no sir i also want the same answer of query which mention above.

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.