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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Navyaragamm
Frequent Visitor

Calculation of averages

Hi , 

 

I am stuck with how to calculate the averages while doing a calculated column 

So , i want result> (average+2*std.dev) and result<(average -2*std.dev) if both are true then yes else no 

Here result is a column called data[Value] and average is of the same column , also the standard deviation

The average here is average of some components and result is value in each row 

Below are the example of calculations , i tried doing a calculated column but all the answers are no . is there a right way to do it , should I use calculated column or measures , Can anyone help 

Here NaB free such are components so the example calculation is 0.4 >0.21+2* 0.269

0.4 is the value of the row

0.21 is the average of that lot number 

0.269 is the std.dev of the lot number

1 ACCEPTED SOLUTION
Sahir_Maharaj
Super User
Super User

Hello @Navyaragamm,

 

Can you please try this approach:

LotAverage = 
CALCULATE(
    AVERAGE(Data[Value]),
    ALLEXCEPT(Data, Data[LotNumber])
)

LotStdDev = 
CALCULATE(
    STDEV.P(Data[Value]),
    ALLEXCEPT(Data, Data[LotNumber])
)

OutOfRange = 
VAR AvgValue = CALCULATE(
    AVERAGE(Data[Value]),
    ALLEXCEPT(Data, Data[LotNumber])
)
VAR StdDevValue = CALCULATE(
    STDEV.P(Data[Value]),
    ALLEXCEPT(Data, Data[LotNumber])
)
RETURN
IF(
    Data[Value] > AvgValue + 2 * StdDevValue || Data[Value] < AvgValue - 2 * StdDevValue,
    "Yes",
    "No"
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

2 REPLIES 2
Sahir_Maharaj
Super User
Super User

Hello @Navyaragamm,

 

Can you please try this approach:

LotAverage = 
CALCULATE(
    AVERAGE(Data[Value]),
    ALLEXCEPT(Data, Data[LotNumber])
)

LotStdDev = 
CALCULATE(
    STDEV.P(Data[Value]),
    ALLEXCEPT(Data, Data[LotNumber])
)

OutOfRange = 
VAR AvgValue = CALCULATE(
    AVERAGE(Data[Value]),
    ALLEXCEPT(Data, Data[LotNumber])
)
VAR StdDevValue = CALCULATE(
    STDEV.P(Data[Value]),
    ALLEXCEPT(Data, Data[LotNumber])
)
RETURN
IF(
    Data[Value] > AvgValue + 2 * StdDevValue || Data[Value] < AvgValue - 2 * StdDevValue,
    "Yes",
    "No"
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning
rajendraongole1
Super User
Super User

Hi @Navyaragamm - create two measures to calculate average and std

 

measure1:

Avg_Value = CALCULATE(AVERAGE('data'[Value]), ALLEXCEPT('data', 'data'[Component]))

Measure2:
StdDev_Value = CALCULATE(STDEV.P('data'[Value]), ALLEXCEPT('data', 'data'[Component]))

 

 create a new calculated column to find the std deviation to check the condition as below:

Result_Check =
VAR Avg = CALCULATE(AVERAGE('data'[Value]), ALLEXCEPT('data', 'data'[Component]))
VAR StdDev = CALCULATE(STDEV.P('data'[Value]), ALLEXCEPT('data', 'data'[Component]))
RETURN
IF(
AND(
'data'[Value] > Avg + 2 * StdDev,
'data'[Value] < Avg - 2 * StdDev
),
"Yes",
"No"
)

 

Hope it works

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors