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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

How to identify values outside of averages?

Hi,

 

My aim is to identify data points where the value for a store is outside of the store's average value for that weekday by + or - 20%

 

For example, if store 1 has a Monday average of 300 and on one particular Monday they have a value of 500, I would like to see this data point as it could be flagged as a potential outlier for investigation.

 

A basic sample of the data struture is given below:

 

DateStoreValue
1/01/20201200
1/01/20202100
1/01/20203300
2/01/20201200
2/01/20202100
2/01/2020320
3/01/20201300
3/01/20202200
3/01/20203100
4/01/20201100
4/01/20202100
4/01/2020325
5/01/20201400
5/01/20202300
5/01/202031000
6/01/20201200
6/01/20202100
6/01/2020340
7/01/202010
7/01/202021000
7/01/2020320

How should I go about creating a measure and visualisaing this?

2 ACCEPTED SOLUTIONS
V-pazhen-msft
Community Support
Community Support

@Anonymous 
The 3 tables should have linked together. 

 

1. Create a Weekday column in Date Table

Weekday = WEEKDAY(DateTable [Date],2)

 

2. The measure can be something like:

 

Outlier = 
Var AvgStoreWeekday= calculate(Average(DataTable[Value]), filter(all(storetable),[storename]=max([storename])),filter(all(datetable),[weekday]=max([weekday]))
Var diffpercent= (Diff = Sum(DataTable[Value]) - [AvgStoreWeekday]) / [AvgStoreWeekday]

Return  IF([diffpercent]<-0.2 || [diffpercent]>0.2), Sum(DataTable[Value]), 0)

 

Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
V-pazhen-msft
Community Support
Community Support

@Anonymous 
The 3 tables should have linked together. 

 

1. Create a Weekday column in Date Table

Weekday = WEEKDAY(DateTable [Date],2)

 

2. The measure can be something like:

 

Outlier = 
Var AvgStoreWeekday= calculate(Average(DataTable[Value]), filter(all(storetable),[storename]=max([storename])),filter(all(datetable),[weekday]=max([weekday]))
Var diffpercent= (Diff = Sum(DataTable[Value]) - [AvgStoreWeekday]) / [AvgStoreWeekday]

Return  IF([diffpercent]<-0.2 || [diffpercent]>0.2), Sum(DataTable[Value]), 0)

 

Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Create a weekday column

Weekday = WEEKDAY([Date],2)

 

Avg Store Weekday= calculate(Average(Table[Value]), Allexcept(Table,Table[Store],Table[Weekday]))

 

You can take Diff with this Avg

 

Diff = Sum(Table[Value]) - [Avg Store Weekday]

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

This almost worked. Assuming I have 3 tables - Date, Store, Data ; How do I adjust the formula to refer to the Weekday column from my date table and the Store Name from my Store table?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.