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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
raduchirila
Frequent Visitor

Multi-calendar previous month forecast measure calculation issue

I have a report that calculates a variance between the current month actuals and the previous month forecasts. The bars are highlighted in red:

raduchirila_0-1632307168118.png

 

The Reporting Month filter is linked to the dim_ReportingCalendar table, while the time axis of the visuals are linked to dim_Calendar table:

raduchirila_1-1632307168126.png

 

The problem I have is to calculate the forecast of the previous selected month.

Let’s take an example:

In August the [Actuals] is 73. In July the [Forecast] for August is 143 => the variance is -70

In July the [Actuals] is 88. In June the [Forecast] for July is 87 => the variance is 1

Measures defined:

Forecast_USD = CALCULATE(SUM(MonthlyCost[Value]), FILTER(MonthlyCost, AND(CONTAINSSTRING(MonthlyCost[Attribute],"ForecastFYCurr??"),LEN(MonthlyCost[Attribute])=16)))

This measure calculates correctly the forecast using the data available for the Reporting Month selected. E.g. for July we will have forecasts from August until the end of the year

 

Forecast_PREV_USD = CALCULATE([Forecast_USD], PREVIOUSMONTH(dim_ReportingCalendar[Date]))

This measure calculates correctly only one month back from the selected Reporting Month and is blank for all previous months.

Basically, we would need a smarter way to calculate PREVIOUSMONTH(PREVIOUSMONTH(… [N times] going back from the Reporting Month selected, for the current year.

 

Sample data:

July data (forecast for Aug-Dec)                 

raduchirila_2-1632307168130.png

August data (forecast for Sept-Dec) 

raduchirila_3-1632307168131.png

RecordDate is linked to the dim_Calendar table, ReportingDate is linked to the dim_ReportingCalendar

 

Already tried a few things:

Forecast_PREV_USD = CALCULATE([Forecast_USD], FILTER(ALL(MonthlyCost), DATEADD(MonthlyCost[RecordDate], -1, MONTH) = (MonthlyCost[ReportingDate])))

Returns the same value for all months

 

Forecast_PREV_USD = CALCULATE([Forecast_USD], FILTER(MonthlyCost, DATEADD(MonthlyCost[RecordDate], -1, MONTH) = (MonthlyCost[ReportingDate])))

Returns only one month depending on the Reporting Month filter

 

Any suggestion would be much appreciated.

2 REPLIES 2
raduchirila
Frequent Visitor

Hi @Tanushree_Kapse 

I tried the measure, but it always return blank. I added a REMOVEFILTERS() or REMOVEFILTERS(dim_ReportingCalendar):

Forecast_PREV_USD = CALCULATE([Forecast_USD], REMOVEFILTERS(), PARALLELPERIOD(MonthlyCost[RecordDate], -1, MONTH))
...butwithout success.
I'm curretly looking with DAX Studio to understand better what filters are applied.
Thanks for your help.
Tanushree_Kapse
Impactful Individual
Impactful Individual

Hi @raduchirila ,

 

YOu can use PARALLELPERIOD function for this:

Use the below measure:

Forecast_PREV_USD = CALCULATE([Forecast_USD], PARALLELPERIOD(MonthlyCost[RecordDate], -1, MONTH))

 

Mark this as a solution, if I answered your question. Kudos are always appreciated.

Thanks.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.