Power Pivot - DAX code to dynamically calculate Run Rate in Excel based on Months Selected

hananak

Board Regular
Joined
Feb 10, 2022
Messages
110
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Dear All,

I am looking for a DAX code in Power Pivot (Pivot Table) to calculate Run Rate dynamically based in the months selected. The Run rate calculation should always exclude the latest month.

There are many (100) Account codes, so the Run Rate calculation is required for each account code.

My months are in columns and called M1 Actual, M2 Actual and so on.

The Financial Year runs from April to March, April being the first month and March being the 12th month.

Please see the picture to understand the outcome.

Your help would be appreciated.
 

Attachments

  • Run Rate.png
    Run Rate.png
    102.3 KB · Views: 9

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
This is a time intelligence problem. Have a read of my article here.

Make sure you have a calendar table
 
Upvote 0
This is a time intelligence problem. Have a read of my article here.

Make sure you have a calendar table
Thanks for sharing these articles. I have read the first article but unable to find any sloution or guidance on how can I resolve my query.

Could you please guide?
 
Upvote 0
Have you created a calendar table with an ID column for month (integer starting at 1 for the first month, 13 for the 13th month, etc) and added it to your model? If not, do that first.
Then add the month from the calendar table to your visual. Don't use the month from your data table.
Then you can write a formula something like this
VBA Code:
Monthly Run Rate =
CALCULATE (
    DIVIDE ( SUM ( DataTable[Actual] ), DISTINCTCOUNT ( Calendar[Month ID] ) ),
    FILTER (
        ALL ( Calendar ),
        Calendar[Month ID] < MAX ( Calendar[Month ID] )
            && Calendar[Fin Year] = MAX ( Calendar[Fin Year] )
    )
)
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top