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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
SDSolutions
Frequent Visitor

Balance Sweep to subsequent month

Hello, I am wondering if anyone can help.

 

In short: I am trying to make a measure to add the cumulative net difference between two fact tables and sweep the balance forward to the first month after the last period of the ACTUALS table.

 

 I have two fact tables, ACTUALS and FORECAST, both related to a Date table, called DATES (and a wider, star schema model). Table ACTUALS has historical and current data up to March of this year and the other Table has forecast data for every month of this year and no prior year data. I have been asked to see if I can sweep the balances from the differences between the two tables into the first month of the forecast, so as to maintain the full year balance when combining actual data with forecast data in a measure.

 

I have the following measures (these are simple sum measures from each table and the below measures are on a table with no relationships):


Actual Minus Forecast = 
//This generates the cumulative value of the variance up to the last month of the ACTUALS table
CALCULATE ( 
        [_Sum Actual] - [_Sum Forecast],
        CALCULATETABLE ( 

                DATESYTD ( DATES[Date] ),

               DATES[Dateswithtransaction]=TRUE 
        )
)

 

Cumulative Actual minus Forecast = 

//This generates a cumulative value that appears to keep the total cumulative value each month for the remainder of the dates in the year. 
CALCULATE ( 

               [Actuals minus Forecast],
               FILTER ( ALL ( DATES ),

                              DATES[Date] <= MAX ( DATES[Date] )
               )

)

 

 

Here is a sample table of the output i have currently generated, plus the desired output i am unable to get:

 

DateSum ActualsSum ForecastActual minus ForecastCumulative Actual minus ForecastDesired output 
01/01/202410010555100Actuals
01/02/20241201251010120Actuals
01/03/20241051202525115Actuals
01/04/2024 110 25135Forecast plus 25
01/05/2024 125 25125Forecast
01/06/2024 130 25130Forecast
01/07/2024 120 25120Forecast
01/08/2024 125 25125Forecast
01/09/2024 115 25115Forecast
01/10/2024 120 25120Forecast
01/11/2024 110 25110Forecast
01/12/2024 115 25115Forecast
Total325142025251430 

 

Any help would be greatly appreciated.

 

Thanks

1 ACCEPTED SOLUTION
AndrewSDTaylor
Regular Visitor

Looks like this calculates the value for the month of April:

SweepmonthActualminusFCST =
VAR MaxDateActuals = CALCULATE ( MAX ( ACTUAL[Date] ), ALL ( ACTUAL ) )
VAR MDAPlusOne = EDATE ( MaxDateActuals, 1)
RETURN
CALCULATE(
    [Cumulative ActualminusFCST],
    FILTER (DATES,
        DATES[Date] = MDAPlusOne
    )
)

View solution in original post

1 REPLY 1
AndrewSDTaylor
Regular Visitor

Looks like this calculates the value for the month of April:

SweepmonthActualminusFCST =
VAR MaxDateActuals = CALCULATE ( MAX ( ACTUAL[Date] ), ALL ( ACTUAL ) )
VAR MDAPlusOne = EDATE ( MaxDateActuals, 1)
RETURN
CALCULATE(
    [Cumulative ActualminusFCST],
    FILTER (DATES,
        DATES[Date] = MDAPlusOne
    )
)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.