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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Begbie
Helper I
Helper I

Last Months Sales Figures to create Run Rate

Hi All,

 

Current have a table called ProductCosts with the following data:

Begbie_0-1674661536767.png

What I am trying to achieve is that I take the last month total amortized cost and multiply this by 12 to calculate the run rate for the year.

 

EG

 

Today would be year 2022, month 12, total amortized cost * 12

When we come into Feburary then it would be year 2023, month 1, total amortized cost * 12

When we come into March then it would be year 2023, month 2, total amortized cost * 12

 

I know this works = 

CALCULATE(SUM(ProductCosts[Total Amortized Cost]), ProductCosts[Month] = 12, ProductCosts[Year] = 2022) * 12
 
But isn't dynamic enough for when the month changes next month.
 
Any ideas or pointers would be greatly appreciated as always 😊
 
Thank you.

 

 

1 ACCEPTED SOLUTION

I managed to figure this out by building 2 measures to check the month - 1 and get the year, then used this as a filter within the DAX

 

Run Rate = CALCULATE(SUM(ProductCosts[Total Amortized Cost]), FILTER(ProductCosts,ProductCosts[Month] = 'Measure Table'[Last Month] && ProductCosts[Year] = 'Measure Table'[Year])) * 12

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Begbie , with help from date table you can get last month measure

 

 

example measures

 

last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I do have a dates talble, see below:

 

Begbie_0-1674721910246.png

 

But when I try changing your query to suit what I need, all it is doing is returning the wrong values unfortuantely 

I managed to figure this out by building 2 measures to check the month - 1 and get the year, then used this as a filter within the DAX

 

Run Rate = CALCULATE(SUM(ProductCosts[Total Amortized Cost]), FILTER(ProductCosts,ProductCosts[Month] = 'Measure Table'[Last Month] && ProductCosts[Year] = 'Measure Table'[Year])) * 12

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors