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
Anonymous
Not applicable

Extrapolate Data from Last Week Sales

Hi there, 

 

I want a column or measure that takes the average of the last 7 days and stores it in the future dates (Extrapolating).

When data is entered, the forecast value is replaced and the new recorded data is used as part of the calculation (Rolling Filter).

 

Shown below is some example data and how I want it to look:

 

DateSales 
4/28/201810ignored
4/29/20185ignored
4/30/20186part of forecast calculation
5/1/20184part of forecast calculation
5/2/20186part of forecast calculation
5/3/20183part of forecast calculation
5/4/20184part of forecast calculation
5/5/20186part of forecast calculation
5/6/20189part of forecast calculation
5/7/2018avgforecasted
5/8/2018avgforecasted
5/9/2018avgforecasted
5/10/2018avgforecasted
5/11/2018avgforecasted
5/12/2018avgforecasted
5/13/2018avgforecasted
5/14/2018avgforecasted
infinityavgforecasted
3 REPLIES 3
v-yuta-msft
Community Support
Community Support

Hi coreyweiss,

 

You requirement is to achieve an average value in last 7 days in every row, right? You can create a measure using DAX like below:

Avg = 
VAR DateStart = MAX(Table1[Date]) - 7
VAR DateEnd = MAX(Table1[Date]) - 1
RETURN
CALCULATE(AVERAGE(Table1[Sales]), Table1[Date] >= DateStart && Table1[Date] <= DateEnd)

捕获.PNG 

You can refer to PBIX file here: https://www.dropbox.com/s/uibfaml6qe26zum/Extrapolate%20Data%20from%20Last%20Week%20Sales.pbix?dl=0.

 

Best Regards,

Jimmy Tao

Anonymous
Not applicable

Hi Jimmy,

 

Your average value in the last 7 days works perfectly, Thank you.

 

However, is it possible to have the historical data in the same measure? I would like to achieve a result like this: 

 

38.png

The data would be similar to what I initially posted in my question. Thanks!

Hi coreyweiss,

 

You want to truncate the date column by previous date and future date and then connect previous date with measure, right.  I'm afraid your requirement can't be achieved because measure will filter values which meets the condition. As a workaround, you can create a line chart and drag column [Sales] and measure [avg] to Values field like below and then you can compare the difference more clearly.

捕获.PNG 

Best Regards,

Jimmy Tao

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.