Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I've been developing reports that look at the average and standard deviations across a visual or table
I have written a simple DAX function to spot and highlight any outliers that go outside of the standard deviation lines:
What I'm now looking to do is spot when 2 or more outliers happen in a row, and highlight these.
So IF the current X-axis cell is an outlier AND the previous X-axis cell was an outlier, highlight BOTH by displaying the two Values.
I want to do similar functions for up to 7-9 cells in a row.
Any help is much appreciated
Hi @michaelmichael ,
Try the measure below:
Measure =
VAR _lastrow =
CALCULATE (
MAX ( 'Table'[X-axis] ),
FILTER ( ALL ( 'Table' ), 'Table'[X-axis] < MAX ( 'Table'[X-axis] ) )
)
VAR _nextrow =
CALCULATE (
MIN ( 'Table'[X-axis] ),
FILTER ( ALL ( 'Table' ), 'Table'[X-axis] > MAX ( 'Table'[X-axis] ) )
)
VAR _lastoutlier =
CALCULATE ( [Outlier], FILTER ( ALL ( 'Table' ), 'Table'[X-axis] = _lastrow ) )
VAR _nextoutlier =
CALCULATE ( [Outlier], FILTER ( ALL ( 'Table' ), 'Table'[X-axis] = _nextrow ) )
RETURN
IF (
OR (
[Outlier] * _lastoutlier
<> BLANK (),
[Outlier] * _nextoutlier
<> BLANK ()
),
1,
2
)
Then apply conditional formatting to Outlier:
Here is a demo, please try it:
Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-joesh-msft thanks for the response, and the demo.
I've got this measure active, but I can't add it into the table because of an error (110, 568) Cannot convert value "of type Text to type Numeric"
My measure for the outlier is as follows:
Hi @michaelmichael ,
Sorry, I forgot to say, need to change Outlier to:
Outlier =
IF (
[Values] < [Average -3StDev],
[Values],
IF ( [Values] > [Average +3StDev], [Values], BLANK () )
)
Use BLANK () instead of "" to see if it works.
Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-joesh-msft the BLANK () worked, thanks
But now the formula doesn't create the 1's. I copied your formula straight in from your demo sheet
Hi @michaelmichael ,
Could you share your sample pbix file for me to have a test, it would help tremendously.
Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |