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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PurpleWave22
Advocate II
Advocate II

Standard Deviation of a Measure

I'm hoping to get some help on how to get the standard deviation of a measure. The intent is to add a flat line of 3x the standard deviation of the complaint rate to this graph:

PurpleWave22_2-1681925793626.png

 

For reference, the complaint rate calculation is this:

Complaint Rate =
'Complaints Report'[Complaints]
    / SUM ( 'Case Report'[Total Cases] )

While "Complaints" is simply:

Complaints =
CALCULATE (
    DISTINCTCOUNT ( 'Complaints Report'[Quality Number] ),
    'Complaints Report'[Is this a complaint?] = "Yes"
) + 0

 

My attempt at the standard deviation calculation:

Complaint Rate StdDev =
CALCULATE (
    STDEVX.S ( 'Complaints Report', [Complaint Rate] ),
    ALLSELECTED ()
)

 

The above is close to what I'm looking for, but upon double checking the math doesn't seem correct, as it is yielding 0.1368% while calculating it in excel and by hand yields 0.1158%:

 

PurpleWave22_3-1681925820277.png

 

I suspect the formula is calculating on a different context than what I want, but I can't figure out how to make it calculate based on the timeframe that is on the graph, which may be in months or quarters and may be more or less than a year in total length.

 

Any help or advice would be appreciated!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @PurpleWave22 

please try

Complaint Rate StdDev =
CALCULATE (
STDEVX.S ( VALUES ( 'Date'[YearMonth] ), [Complaint Rate] ),
ALLSELECTED ()
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @PurpleWave22 

please try

Complaint Rate StdDev =
CALCULATE (
STDEVX.S ( VALUES ( 'Date'[YearMonth] ), [Complaint Rate] ),
ALLSELECTED ()
)

Hi @tamerj1 

This seems to have worked! Can you explain the logic behind it? I'm not sure I completely understand.

@PurpleWave22 

The X-Aggregators in dax are iterators. The need to iterate the right table at the right granularity. 

Greg_Deckler
Community Champion
Community Champion

@PurpleWave22 This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.