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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
hmustafa
Regular Visitor

Linking forecasts to actuals using a unique identifier and finding variances

Hello everyone,

 

A short synopsis of what I am trying to accomplish. Currently, using excel i am able to extract salary forecasts and actuals in order to identify variances. For example, an employee has a salary forecast for five periods in a year. For each forecast, there are five to six lines of actual pay.

 

Using the following formulas, i've been able to identify all segments of actual data that are a match for each forecast.

 

First, I assign each forecast a forecast number:

 

=IF(P5="Forecast",ROW(A5),"")

 

Next, for each line of "actuals" data, i identify matching forecasts using an employee #:

 

{=IFERROR(INDEX($A$5:$A$9882, SMALL(IF($D5=$A$5:$D$9882,IF(AND(OR($P5="actual",$P5="actual adjustment"),CD5="Include"),IF($P$5:$P$9882="Forecast",IF($CC5=$CC$5:$CC$9882,ROW($D$5:$D$9882)-ROW($D$5)+1)))), COLUMN(A1)))," ")}    -ARRAY. I copy and paste this formula along many columns to insure all forecasts are captured. 

 

I then use vlookups with the forecast number to identify the # of overlapping days and then calculate the $ value.

 

For each forecast, I am able to calculate the applicable actuals by use of this formula (negative balances are excluded and included elsewhere):

 

=IFERROR(IF(P5="Forecast",(BW5/(SUMIF($CL$5:$CL$3004,$CL5,$BW$5:$BW$209))*(SUMIFS($CU:$CU,$CQ:$CQ,$A5,$CU:$CU,">0")+SUMIFS($CZ:$CZ,$CV:$CV,$A5,$CZ:$CZ,">0")+SUMIFS($DE:$DE,$DA:$DA,$A5,$DE:$DE,">0")+SUMIFS($DJ:$DJ,$DF:$DF,$A5,$DJ:$DJ,">0")+SUMIFS($DO:$DO,$DK:$DK,$A5,$DO:$DO,">0")+SUMIFS($DT:$DT,$DP:$DP,$A5,$DT:$DT,">0")+SUMIFS($DY:$DY,$DU:$DU,$A5,$DY:$DY,">0")+SUMIFS($ED:$ED,$DZ:$DZ,$A5,$ED:$ED,">0")+SUMIFS($EI:$EI,$EE:$EE,$A5,$EI:$EI,">0")+SUMIFS($EN:$EN,$EJ:$EJ,$A5,$EN:$EN,">0")+SUMIFS($ES:$ES,$EO:$EO,$A5,$ES:$ES,">0")+SUMIFS($EX:$EX,$ET:$ET,$A5,$EX:$EX,">0")+SUMIFS($FC:$FC,$EY:$EY,$A5,$FC:$FC,">0")+SUMIFS($FH:$FH,$FD:$FD,$A5,$FH:$FH,">0")+SUMIFS($FM:$FM,$FI:$FI,$A5,$FM:$FM,">0")+SUMIFS($FR:$FR,$FN:$FN,$A5,$FR:$FR,">0")+SUMIFS($FW:$FW,$FS:$FS,$A5,$FW:$FW,">0")+SUMIFS($GB:$GB,$FX:$FX,$A5,$GB:$GB,">0")+SUMIFS($GG:$GG,$GC:$GC,$A5,$GG:$GG,">0")+SUMIFS($GL:$GL,$GH:$GH,$A5,$GL:$GL,">0")+SUMIFS($GQ:$GQ,$GM:$GM,$A5,$GQ:$GQ,">0")+SUMIFS($GV:$GV,$GR:$GR,$A5,$GV:$GV,">0")+SUMIFS($HA:$HA,$GW:$GW,$A5,$HA:$HA,">0")+SUMIFS($HF:$HF,$HB:$HB,$A5,$HF:$HF,">0"))),0),0)

 

Is there anyway to A) Simply this, and B) replicate this in Power BI?

4 REPLIES 4
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @hmustafa,

 

Could you please share a dummy sample? Because Power BI does this in a different way that is more dynamical. The data model structure and relationship are critical to a formula in Power BI. Please share a sample.

 

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-jiascu-msft

 

The following is a sample of data:

 

Fiscal YearPersonnel numberDocument TypeForecast type descriptionRecord type descriptionForecast Group DescriptionEnt/Ded from dateEnt/Ded to dateEffective From DateEffective To DateType of PayEnd DateGross Full Year ForecastNet actual
201811111111F3Basic PayActualIndeterminate FT2017-04-012017-04-05  Basic Pay 0.001500.00
201811111111F3Basic PayActualIndeterminate FT2017-04-062017-04-19  Basic Pay 0.005000.00
201811111111F3Basic PayActualIndeterminate FT2017-04-202017-05-03  Basic Pay 0.005000.00
201811111111F3Basic PayActualIndeterminate FT2017-05-042017-05-17  Basic Pay 0.005000.00
201811111111F3Basic PayActualIndeterminate FT2017-05-182017-05-31  Acting Pay 0.005000.00
201811111111F3Basic PayActualIndeterminate FT2017-06-012017-06-14  Basic Pay 0.005000.00
201811111111F3Basic PayActualIndeterminate FT2017-06-152017-06-28  Basic Pay 0.005000.00
201811111111F3Basic PayActualIndeterminate FT2017-06-292017-07-12  Basic Pay 0.005000.00
201811111111F3Basic PayActualIndeterminate FT2017-07-132017-07-26  Basic Pay 0.005000.00
201811111111F3Basic PayActualIndeterminate FT2017-07-272017-08-09  Basic Pay 0.005000.00
201811111111F3Basic PayActualIndeterminate FT2017-08-102017-08-23  Basic Pay 0.005000.00
201811111111F3Basic PayActualIndeterminate FT2016-06-162016-06-16  Basic Pay 0.00700.00
201811111111F3Basic PayActualIndeterminate FT2016-06-172016-06-24  Basic Pay 0.002500.00
201811111111F3Basic PayActualIndeterminate FT2017-08-242017-09-06  Basic Pay 0.005000.00
201811111111F3Basic PayActualIndeterminate FT2017-09-072017-09-20  Basic Pay 0.005000.00
201811111111F3Basic PayActualIndeterminate FT2016-04-012016-05-08  Basic Pay 0.001500.00
201811111111F3Basic PayActualIndeterminate FT2016-05-092016-05-11  Basic Pay 0.00300.00
201811111111F3Basic PayActualIndeterminate FT2016-05-122016-05-30  Basic Pay 0.00750.00
201811111111F3Basic PayActualIndeterminate FT2016-05-312016-06-01  Basic Pay 0.00100.00
201811111111F3Basic PayActualIndeterminate FT2016-06-022016-06-16  Basic Pay 0.00500.00
201811111111F3Basic PayActualIndeterminate FT2016-06-172016-06-24  Basic Pay 0.00300.00
201811111111F3Basic PayActualIndeterminate FT2016-06-252016-08-04  Basic Pay 0.001500.00
201811111111F3Basic PayActualIndeterminate FT2016-08-052016-08-19  Basic Pay 0.00500.00
201811111111F3Basic PayActualIndeterminate FT2016-08-202016-10-03  Basic Pay 0.001500.00
201811111111F3Basic PayActualIndeterminate FT2016-10-042016-10-14  Basic Pay 0.00500.00
201811111111F3Basic PayActualIndeterminate FT2016-10-152016-11-07  Basic Pay 0.00750.00
201811111111F3Basic PayActualIndeterminate FT2016-11-082016-11-09  Basic Pay 0.00100.00
201811111111F3Basic PayActualIndeterminate FT2016-11-102017-01-26  Basic Pay 0.002800.00
201811111111F3Basic PayActualIndeterminate FT2017-01-272017-02-03  Basic Pay 0.00300.00
201811111111F3Basic PayActualIndeterminate FT2017-02-042017-03-31  Basic Pay 0.002000.00
201811111111F3Basic PayActualIndeterminate FT2017-09-212017-10-04  Basic Pay 0.004500.00
201811111111F3Basic PayActualIndeterminate FT2017-10-052017-10-18  Basic Pay 0.004500.00
201811111111F3AllowanceActualBilingual Bonus2017-04-012017-04-05  Bilingual Bonus 0.0015.00
201811111111F3AllowanceActualBilingual Bonus2017-04-062017-04-19  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-04-202017-05-03  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-05-042017-05-17  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-05-182017-05-31  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-06-012017-06-14  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-06-152017-06-28  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-06-292017-07-12  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-07-132017-07-26  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-07-272017-08-09  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-08-102017-08-23  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-08-242017-09-06  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-09-072017-09-20  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-09-212017-10-04  Bilingual Bonus 0.0040.00
201811111111F3AllowanceActualBilingual Bonus2017-10-052017-10-18  Bilingual Bonus 0.0040.00
201811111111 Basic PayForecastIndeterminate FT  2017-06-019999-12-31 9999-03-3184516.000.00
201811111111 Acting PayForecastIndeterminate FT  2017-05-182017-05-31  7500.00 
201811111111 Basic PayForecastIndeterminate FT  2016-01-272017-05-17  32150.000.00
201811111111 AllowanceForecastBilingual Bonus  2017-02-049999-12-31 9999-03-311200.000.00

 

I match the "forecast type description" with "Type of Pay" and match "Ent/Ded from Date" and "Ent/ded to date" with the "effective from date" amd "effective to date" to capture pays that fall into that forecasted period.

 

Thanks,

Mustafa

 

Hi Mustafa,

 

Try this formula as a calculated column.

 

Sum actual =
IF (
    [Record type description] = "Actual",
    0,
    CALCULATE (
        SUM ( Table1[Net actual] ),
        FILTER (
            'Table1',
            'Table1'[Type of Pay] = EARLIER ( 'Table1'[Forecast type description] )
                && 'Table1'[Ent/Ded from date] >= EARLIER ( Table1[Effective From Date] )
                && 'Table1'[Ent/Ded to date] <= EARLIER ( 'Table1'[Effective To Date] )
        )
    )
)

Linking forecasts to actuals using a unique identifier and finding variances.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-jiascu-msft

 

Hi Dale,

 

This is great but I run into an issue where there are some actual lines which dont entirely fit into the forecast period. In scenarios where ent/ded from date is greater than the effective from date and ent/ded to date is greater than effective to date, i need the program to calculate the # of days overlapping and apply that portion to the forecast line. Does this make sense?

 

The way i have been doing it is calculating the number of network days between the actual period (ent/ded from date to ent/ded to date) and then finding a per day value. Then I would apply this to the forecast period by finding the number of days overlapping, either effective from to ent/ded to date or ent/ded from to effective to date.

 

On a side note, happy to now have a better understanding of the filter and earlier functions.

 

Thanks,

Mustafa

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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