Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
Hi everyone
I have a problem that I am struggling with and can see similar topics that have been resolved but not exactly the same.
I was wondering if anyone can point me in the right direction.
Issue
Displaying current financial year month actuals up until current month and then forecast for future months
Data structure
EmployeeCosts =
CALCULATE( SUM( 'Employees'[Monthly Costs]),
FILTER( 'Employees', 'Employees'[Start Date] <= MAX( 'Date'[Date]) && ( ISBLANK( 'Employees'[End Date]) || 'Employees'[End Date] > MAX ('Date'[Date]))), ('Employees'[Title)))
PayrollCosts =
CALCULATE( SUM( 'Payroll'[Actual],
FILTER( 'Employees', 'Employees'[Start Date] <= MAX( 'Date'[Date]) && (ISBLANK('Employees'[End Date]) || 'Employees'[End Date] > MAX( 'Date'[Date]))), ('Employees'[Title]),
USERELATIONSHIP( 'Date'[Date], Payroll[Payroll End Date]))
Current attempt
So I have tried resolve this with a measure on Payroll as follows but it only is showing the actuals
ActualForecasts =
IF( SELECTEDVALUE( 'Payroll'[Payroll End Date] <= MONTH( TODAY()),
'Payroll'[PayrollCosts],'Employees'[EmployeeCosts])
Any help/guidance would be much appreciated!
Solved! Go to Solution.
Hi, @metcala
You can try the following methods.
Add a new month-end date table to make the column of the matrix.
Measure =
VAR _actual =
CALCULATE (
SUM ( Payroll[Monthly Actual Cost] ),
FILTER (
ALL ( Payroll ),
[Employee ID] = SELECTEDVALUE ( Payroll[Employee ID] )
&& [Payroll End Date] = SELECTEDVALUE ( 'Date'[Month end] )
)
)
VAR _forecast =
CALCULATE (
SUM ( Employee[Expected Monthly Salary] ),
FILTER (
ALL ( Employee ),
[Employee ID] = SELECTEDVALUE ( Payroll[Employee ID] )
)
)
RETURN
IF ( _actual = BLANK (), _forecast, _actual )
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @metcala
Can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures or Excel. I look forward to your response.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi there thanks for getting back, hopefully this makes a little bit more sense....
Employee table
Employees
Payroll table
Payroll actual
Expected result
Expected Result
I have tested the logic for the measures in my original message which appears to be correct. I just want to check if there is actual payroll data and if so use that otherwise revert to the total in the employee table for the expected monthly cost.
Sorry for not being clear in my initial message.
Thanks in advance!
Hi, @metcala
You can try the following methods.
Add a new month-end date table to make the column of the matrix.
Measure =
VAR _actual =
CALCULATE (
SUM ( Payroll[Monthly Actual Cost] ),
FILTER (
ALL ( Payroll ),
[Employee ID] = SELECTEDVALUE ( Payroll[Employee ID] )
&& [Payroll End Date] = SELECTEDVALUE ( 'Date'[Month end] )
)
)
VAR _forecast =
CALCULATE (
SUM ( Employee[Expected Monthly Salary] ),
FILTER (
ALL ( Employee ),
[Employee ID] = SELECTEDVALUE ( Payroll[Employee ID] )
)
)
RETURN
IF ( _actual = BLANK (), _forecast, _actual )
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you very much, that has worked perfectly!!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
11 | |
10 | |
10 | |
10 |
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
8 |