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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
andcol
Frequent Visitor

Smoothing Data with a median filter

Hello,

I am looking to plot the google mobility data for a few countries (line with Date on axis and Value1 in value, the legend is Country_Region), so i have something looking like the image below. What I want to do it create a rolling 7-day median filter that will remove the spikes caused by holidays etc. ... Can this be done via DAX?

Thanks in advance,

Andrew

 

andcol_0-1602233151879.png

 

2 REPLIES 2
amitchandak
Super User
Super User

@andcol ,

example

Rolling 7 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX(Sales[Sales Date]),-7,DAY)) /7
Rolling 7 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-7,DAY))/7

 

or divide distinct count of days

 

or

 

Rolling 7 = CALCULATE(Average(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX(Sales[Sales Date]),-7,DAY))
Rolling 7 = CALCULATE(Average(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-7,DAY))

 

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

@amitchandak 

 

Thanks. Can a median filter, rather than a 7-day average be incorporated, I basically want to exclude these spikes rather than average them out and drag down surrounding points. Thanks

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors