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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
PJHos
Advocate I
Advocate I

forecast + actual data

Hi All,

 

I have calculated a forecast based on historic data for the last 6 years using the below and dividing it by total years. This works fine

 

Forecasting - Cumulative Forecast =
                    VAR StoressOpenedLY = CALCULATE(
                                                [Total No Of Storess], DATEADD('Stores Attributes Calender'[Date].[Date], -1, YEAR) )


I now want to combine this with the actuals so the forecast data only begins where the actuals end and I am having problems with the following DAX

 

Forecasting - No of Stores Opened & Forecast Data Model =
                            VAR LastopenedDate = CALCULATE( MAX('Sales Attributes'[date store opened].[Date]), REMOVEFILTERS())
                            VAR ActualStoresOpened = COUNT('SalesAttributes'[Total Number Of Open Stores])
                            VAR ForecastTotal = CALCULATE([Forecasting - Cumulative Forecast], KEEPFILTERS( 'Store Attributes Calender'[Date].[Date] > [Forecasting - Last Store Opening Date]))
                            VAR Result = ForecastTotal + ActualStoresOpened
                               
                                                   RETURN

                                                    Result
 
I have run the result on the other variables and all work fine except forecase total. As soon as i use the FILTER logic it gives me a 'placeholder' error
 
Can someone help please 😥
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@PJHos , do not use .date. Mark you calendar table as  date table, that option will go away

 

Forecasting - Cumulative Forecast =
VAR StoressOpenedLY = CALCULATE(
[Total No Of Storess], DATEADD('Stores Attributes Calender'[Date], -1, YEAR) )

 

 

and

 

VAR ForecastTotal = CALCULATE([Forecasting - Cumulative Forecast], KEEPFILTERS( 'Store Attributes Calender'[Date]> [Forecasting - Last Store Opening Date]))

 

 

also can explain need of KEEPFILTERS( 'Store Attributes Calender'[Date]> [Forecasting - Last Store Opening Date])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@PJHos , do not use .date. Mark you calendar table as  date table, that option will go away

 

Forecasting - Cumulative Forecast =
VAR StoressOpenedLY = CALCULATE(
[Total No Of Storess], DATEADD('Stores Attributes Calender'[Date], -1, YEAR) )

 

 

and

 

VAR ForecastTotal = CALCULATE([Forecasting - Cumulative Forecast], KEEPFILTERS( 'Store Attributes Calender'[Date]> [Forecasting - Last Store Opening Date]))

 

 

also can explain need of KEEPFILTERS( 'Store Attributes Calender'[Date]> [Forecasting - Last Store Opening Date])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi Amit

 

Thank you very much!! It worked

 

also can explain need of KEEPFILTERS( 'Store Attributes Calender'[Date]> [Forecasting - Last Store Opening Date])

 

This was so i can have actuals and forecast totals in 1 column

 

Thank you again, marked as answered😀

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.