Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am a complete beginner with DAX, so I apologise in advance if my question has a very easy answer.
Let's say I have a dataset containing two text columns ('Var1' and 'Var2'), and a column with values called 'Values'.
I have built a PivotTable with PowerPivot, where the values are the sum of the 'Values', 'Var1' is in the rows, and 'Var2' is in the columns.
What I want to do is to replace those entries that are less than 3 standard deviations below the average across Var1 (but not including Var2) with 0's.
Simply put, I am looking to have a measure that does the following:
calculate the average grouped by Var1, then the standard deviation grouped by var1. Is each value in the pivot table (which is actually grouped by Var1 and Var2) less than the average minus 3x the standard deviation? If so, replace with 0, otherwise keep the value.
Many thanks
Solved! Go to Solution.
I think the below should work
Replace Outliers =
VAR var1 =
ALL ( 'Table'[Var1] )
VAR avg =
AVERAGEX ( var1, CALCULATE ( SUM ( 'Table1'[Value] ) ) )
VAR stdDev =
STDEVX.P ( var1, CALCULATE ( SUM ( 'Table1'[Value] ) ) )
VAR currentVal =
CALCULATE ( SUM ( 'Table1'[Value] ) )
RETURN
IF ( currentVal < avg - ( stdDev * 3 ), 0, currentVal )
I think the below should work
Replace Outliers =
VAR var1 =
ALL ( 'Table'[Var1] )
VAR avg =
AVERAGEX ( var1, CALCULATE ( SUM ( 'Table1'[Value] ) ) )
VAR stdDev =
STDEVX.P ( var1, CALCULATE ( SUM ( 'Table1'[Value] ) ) )
VAR currentVal =
CALCULATE ( SUM ( 'Table1'[Value] ) )
RETURN
IF ( currentVal < avg - ( stdDev * 3 ), 0, currentVal )
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |