Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Using Past Average to Predict Future Outcome

I current have this DAX

AverageDemanLast6Weeks =
VAR StartDate = TODAY() - 42
VAR EndDate = TODAY()
RETURN
AVERAGEX(
    FILTER(
        'Date',
        'Date'[Date] >= StartDate && 'Date'[Date] <= EndDate
    ),
    [Total_Demand_Rate]
)
The DAX gives the average of the Demand Rate over the Last 6 Weeks.
Here is where I am having a challenge. 
I need to create a DAX that will do the following:
 
 If I select any day of the week in the future, if the date falls on a Monday, give me the result of All the averages for the last 6 Mondays. A typical example is if I select a date of 03/04/2024 (Which falls on a Monday). Then what i want to see is the average of the demand rates for the last 6 Mondays. (02/26/2024, 02/19/2024, 02/12/2024, 02/05/2024, 01/29/2024, 01/22/2024). If the selected date in the future falls on a Wednesday, I want the same result, show me the average of the demand rates for the last 6 Wednesdays.
What I am trying to predict is that based on the events of the last 6 weeks, We can assume we should be expecting the same or similar in the future.

 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

     Hi Anonymous 

    I don't quite understand how you want to use the last six weeks to predict future values, do you need to use Dax based on the last six weeks? Can you provide some more information and sample data so that can provide more information for you.

     

    Best Regards

    Yolo Zhu

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you for getting back Yolo,

    So here is what I am trying to achieve. 

    I have a DAX measure that has calculated the Average demand for the last 6 weeks. 
    I want to have a new DAX that will do the following :
    If I  select any day of the week in the future. For instance, if I select a Monday, what I would love to see the Average Demands for the Last 6 Mondays (The 6 Mondays in the calculated DAX)

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Anonymous 

      Can you provide some sample data?

       

      Best Regards

      Yolo Zhu