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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
PBI_newuser
Post Prodigy
Post Prodigy

How to calculate the current forecast count based on the rate and count in previous month

Hi,

I have a forecast rate Table to forecast the current month count based on last month.

For example, 2021-02 is 129 count and this month is 2021-03. The forecast count should be 129 * (1+10.5%) = 143.

How to create a measure to calculate if Month(Today()) = Rate[Month], then PreviousMonth(Date) * Rate?

Here is the sample.

PBI_newuser_0-1614574246502.png

 

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @PBI_newuser ,

 

Please follow these steps:

1. Add a MonthNumber column to Rate table:

MonthNumber =
MONTH ( CONVERT ( [Month] & " 1", DATETIME ) )

2. Add a Rate column to Data table.

Rate =
VAR _month =
    IFERROR ( CONVERT ( RIGHT ( [Period], 2 ), INTEGER ), BLANK () )
VAR _m =
    IF ( _month = 12, 0, _month )
RETURN
    LOOKUPVALUE ( 'Rate'[Rate], 'Rate'[MonthNumber], _m + 1 )

3. Create measure:

Measure =
[ID Count]
    * ( MAX ( 'data'[Rate] ) + 1 )

The final output is shown below:

3.3.2.previous.PNG

 

Please take a look at the pbix file here.

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-eqin-msft
Community Support
Community Support

Hi @PBI_newuser ,

 

Please follow these steps:

1. Add a MonthNumber column to Rate table:

MonthNumber =
MONTH ( CONVERT ( [Month] & " 1", DATETIME ) )

2. Add a Rate column to Data table.

Rate =
VAR _month =
    IFERROR ( CONVERT ( RIGHT ( [Period], 2 ), INTEGER ), BLANK () )
VAR _m =
    IF ( _month = 12, 0, _month )
RETURN
    LOOKUPVALUE ( 'Rate'[Rate], 'Rate'[MonthNumber], _m + 1 )

3. Create measure:

Measure =
[ID Count]
    * ( MAX ( 'data'[Rate] ) + 1 )

The final output is shown below:

3.3.2.previous.PNG

 

Please take a look at the pbix file here.

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-eqin-msft , thanks!!! It works. 😊

amitchandak
Super User
Super User

@PBI_newuser ,

Try with a date table

 

Forecast = CALCULATE([ID Count],DATESMTD(dateadd('Date'[Date],-1,MONTH))) * (1+CALCULATE([Rate],DATESMTD(dateadd('Date'[Date],-1,MONTH))))

 

or

 

Forecast = CALCULATE([ID Count],DATESMTD(dateadd('Date'[Date],-1,MONTH))) * (1+CALCULATE([Rate],DATESMTD(dateadd('Date'[Date],-1,MONTH)))/100)

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Hi @amitchandak , how if the Date for Rate table is text?

PBI_newuser_0-1614578752985.png

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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