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

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.

Reply
Anonymous
Not applicable

Show boxplot outliers with dynamic STDEV

Dear Power BI users,

 

I have Sales dataset consisting of (1) ProductCategory, (2) Customer, (3)NetSales, (4) Margin. Margin percentage was calculated with a calculated measure:

Margin% =DIVIDE(SUM(dataset[Margin]);SUM(dataset[NetSales]))

Based on this I made a Boxplot (Box and Whisker by MAQ Software) in order to detect outliers on Margin%.

 

Until so far this all worked out perfectly well.

 

However, next to my boxplot I also would like to put a table presenting the outlying customers per product category. As you can see I below I presented a list of all customers with their margin, but I would like to present only the outliers (note that the upper and lower whisker is on one standard deviation from the mean).

Community.PNG

 

I tried to calculate the =STDEV.P on Margin% by myself, but this wasn't possible since Margin% is a calculated measure.

 

To summarise, I would like to know how I can calculate the standard deviation on a calculated measure (which is dynamic when I use filters on year-month, productcategory, etc.).  Or does anyone know an easier way to show outliers in this case?

 

Many thanks in advance for your help!

4 REPLIES 4
MAQSupport
Solution Supplier
Solution Supplier

Hello @Anonymous,

 

You can refer to the Calculations document of Box and Whisker by MAQ software available at our GitHub page.

 

Thanks.

Anonymous
Not applicable

I already tried to calculated stdev, mean margin and subsequently tried to determine the outliers.

 

stdev = DTDEVX.P(dataset;[Margin])

mean margin = AVERAGEX(dataset;[Margin%])

outlier = IF([Margin%]<([mean margin] - [stdev]);1;0)

See below: unfortunetely the three outliers have a value of 0 instead of the desired 1.

 

The total stdev and mean margin on C are correct!

 

Community2.PNG

Hi @Anonymous,

 

Based on your image and the formulas, it seems that outliers is correct.

 

I'm a little confused about your formula about stdev = DTDEVX.P(dataset;[Margin]).

 

As I know, we should use STDEV.P(<ColumnName>)  to returns the standard deviation in Power BI. Are you sure you calculate the stdev is correct with DTDEVX.P function?

 

If it is convenient, could you share some data sample and your desired output so that we could help further on it?

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-piga-msft

 

Desired output is a matrix showing only outliers (from my boxplot).

 

Knipsel.PNG

 

Sample data:

 

ProductCategory Customer  Sales   Margin
C Customer 1  € 234,00   € 3,00
C Customer 2  € 23,00   € 1,07
C Customer 3  € 34,00   € 2,28
A Customer 1  € 47,00   € 4,49
A Customer 2  € 543,00   € 55,39
A Customer 4  € 234,00   € 25,18
A Customer 5  € 23,00   € 2,47
A Customer 6  € 34,00   € 3,66 
A Customer 7  € 47,00   € 5,11 
A Customer 2  € 543,00   € 59,73 
B Customer 8  € 98,00   € 10,82 
A Customer 2  € 633,00   € 70,39 
A Customer 9  € 38,00   € 4,27  
B Customer 8  € 84,00   € 9,44  

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.