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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Median and Standard Deviation over a data set

Hello

 

I’ve got the data set and a number of measures ...

 

Snip1png.png

 


The first measure [Success_Count] calculates the number of Successes and the second [Average_Success] calculates the average Monthly success…

Success_Count = CALCULATE (
DISTINCTCOUNT(ExamResults[StudentID]),
FILTER (
ExamResults,
ExamResults[Months_on_Course] >= 3
&& ( ( ExamResults[ExamStatus] = "Pass" )
|| ( ExamResults[ExamStatus] = "Distinction" ) )
)
)

Average_Success = DIVIDE([# Success_Count] ,DISTINCTCOUNT ( ExamResults[StartDate+3M]) )


My question is, how do I calculate the Median and Standard Deviation values by month across the data set. I've tried it various different ways using Calculated table
GroupBy etc,but can't seem to get it to work correctly, or get the "Student_Sum" below value into a Calculate function?

 

DEFINE
VAR myGroup =
FILTER (
GROUPBY (
ExamResults,
ExamResults[Months_on_Course],
ExamResults[ExamStatus],
ExamResults[StartDate+3M],
"Student_Count", COUNTX ( CURRENTGROUP (), ExamResults[StudentID] )
),
ExamResults[Months_on_Course] >= 3
&& ( ( ExamResults[ExamStatus] = "Pass" )
|| ( ExamResults[ExamStatus] = "Distinction" ) )
)
EVALUATE
GROUPBY (
myGroup,
ExamResults[StartDate+3M],
"Student_Sum", SUMX ( CURRENTGROUP (), [Student_Count] )
)


Any suggestion much appreciated

1 REPLY 1
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Try the below DAX function.

Standard Deviation Sales Qty = STDEV.P( Sales[Quantity] )
Median Sales Qty = MEDIAN( Sales[Quantity] )

 

There are X functions available in both cases, so you can perform aggregations on different granularities if needed.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors