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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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