This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
New to Power BI but have some experience with Tableau.
Looking to add a measure that calculates the standard deviation for unique categorical values in a column. For example, Column A has a category. Column B has the values on which I need to calculate the standard deviation. I need to calculate the st dev of Column B for all unique categories of Column A. Example data below:
| Column A | Column B |
| Name1 | 204.0730158 |
| Name2 | 7176.691379 |
| Name3 | 129.2877416 |
| Name1 | 205.8627572 |
| Name2 | 7203.935509 |
| Name3 | 130.522898 |
| Name1 | 207.2325321 |
| Name2 | 7231.588786 |
| Name3 | 130.8039379 |
Name1 st dev would use 204.0730158, 205.8627572, and 207.2325321. Name2 and Name3 st deve would follow in similar manner. Hoping to setup a measure that would do all that for me so I can use it in line charts and scatter plots.
Any ideas? Thanks in advance.
Solved! Go to Solution.
I figured it out. Had to use nested filtering described in this article from 2012.
Measure code looks like this:
calculate(
STDEV.P(Column B)
,FILTER(
ALL('Table')
,COUNTROWS(
FILTER(
'Table'
,EARLIER(Column A) = Column A
)
)
)
)
Measure =
Calculate (
STDEV.P('TableName'[ColumnB]),
ColumnA = "Name1")
Yeah, I thought of that but I need it to dynamically load what goes into the CALCULATE() filter based on the row Power BI is evaluating. So it would be something like:
Calculate (
STDEV.P('TableName'[ColumnB]),
ColumnA = {Value from Column A in row being evaluated})
I just can't figure out how to tell it to do it that way. Another way I've gotten this to work in Excel is using the following formula as an array formula.
=STDEV.P(IF($A$2:$A$9000=A2,$B$2:$B$9000))
I figured it out. Had to use nested filtering described in this article from 2012.
Measure code looks like this:
calculate(
STDEV.P(Column B)
,FILTER(
ALL('Table')
,COUNTROWS(
FILTER(
'Table'
,EARLIER(Column A) = Column A
)
)
)
)
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 35 | |
| 32 | |
| 26 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 68 | |
| 36 | |
| 32 | |
| 25 | |
| 23 |