Use DAX to Manipulate Filter Context to Show Future Forecast & Past Sales

Continuing the discussion from Historical Sales and Current Forecast - Past and Future Dates:

@BrianJ , is there a way to solve this using DAX by manipulating the filters? From my understanding using the ISAFTER logic in the date table requires you to place a filter on the visual or page. In my circumstance I want to be able to look at Actuals say 24 months back from the previous month, we are in December 2021 so that would be from November 2021 back 24 months. This would exclude any future orders. This would be one measure. We would also want to look at the future forecast out 24 months from the current month (so from December 2021 and forward). This would exclude any historical forecast that might come in. This would be the second measure. All of this would need to be dynamic as well as the month changes this would update. I am looking for the flexibility to have the visual show the range of 24 months back and 24 months forward for each of these two measures in the same visual.

@jcantillo11

First Create Monthoffset in Date table then create 2 measures like below
In this sample I’m showing past 3 months actuals and future 3 months fcst

You can change the code based on your requirement

Actuals and Fcst.pbix (67.0 KB)

Thank you for answering @Rajesh.

We hope this helped you @jcantillo11 :slight_smile:

If not, how far did you get and what kind of help you need further?

If yes, kindly mark as solution the answer that solved your query.

@Rajesh , this works like a charm! Cheers