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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
dirty2k9
Regular Visitor

Incorrect Grand Total in Forecast Measure

I give up! First off, thank you in advance for the help. I have been struggling with this problem for a couple of days now and know it's a context issue. However, I am new to Power BI and haven't had that Ah-Ha moment yet.

 

I have a Calendar table and Payroll table that had a one to many relationship on Date. I'm trying to create a measure that combines actual monthly payroll with projected monthly payroll. Projected monthly payroll is simply last month's payroll as it should remain constant for the remainder of the fiscal year. My goal is to plot actuals and forecasted running totals on one line chart and use what if scenarios to project future payroll expenses.

 

The problem I'm having is my grand total only consists of actuals. I've tried so many different functions in just about every variable and can't quite get it.

 

Any help is greatly appreciated.

 

 

Projected Payroll = 
VAR currentMonth = CALCULATE(MAX('Payroll Details'[Fiscal Year & PP]), REMOVEFILTERS())
VAR payrollActuals = CALCULATE(SUM('Payroll Details'[Amount]), FILTER('Payroll Details', 'Payroll Details'[Fiscal Year & PP] < currentMonth))
VAR lastMonthsPayroll = CALCULATE(SUM('Payroll Details'[Amount]), 'Payroll Details'[Fiscal Year & PP] = currentMonth - 1, ALLSELECTED('Payroll Details'))
VAR projectedPayroll = IF(payrollActuals = BLANK() || MAX('Date'[Fiscal Year & PP]) = currentMonth, lastMonthsPayroll)
VAR result = payrollActuals + projectedPayroll
RETURN result

 

 

Capture.PNG

2 REPLIES 2
amitchandak
Super User
Super User

@dirty2k9 , try to change return like

Sumx(Values(Date[Fiscal Month]), result)

 

or

 create a new measure

 

Projected Payroll 1=
Sumx(Values(Date[Fiscal Month]), [Projected Payroll])

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

Thank you for the quick response. I tried both of your suggestions and both produce incorrect values. See the attached pic.

 

Capture(1).PNG

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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