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

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
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.