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

Join 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.

Reply
metcala
Helper III
Helper III

Showing monthly actual data and forecast data

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

  • Date table
    Date
    Calendar Year
    Month Name
    Month Number

  • Employees
    Employee ID
    Title
    Name
    Start Date
    End Date
    ...
    EmployeeCosts (Measure)

 

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)))​



 

  • Payroll Actuals
    ...
    Payroll End Date
    Employee ID
    Monthly Cost
    PayrollCosts (Measure)

 

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!

1 ACCEPTED SOLUTION

Hi, @metcala 

 

You can try the following methods.

Add a new month-end date table to make the column of the matrix.

vzhangti_0-1668763201261.png

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 )

vzhangti_1-1668763310916.png

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.

View solution in original post

4 REPLIES 4
v-zhangti
Community Support
Community Support

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.

@v-zhangti 

 

Hi there thanks for getting back, hopefully this makes a little bit more sense....

 

Employee table

 

EmployeesEmployees

 

Payroll table

 

Payroll actualPayroll actual

 

Expected result

 

Expected ResultExpected 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.

vzhangti_0-1668763201261.png

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 )

vzhangti_1-1668763310916.png

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!!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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