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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
mmarshalek
Frequent Visitor

Calculation of 2 values different dates

MAPE.PNG

I've been working on this for about 5 days now,...  and really stuck...  Could use help...  I've attached my Power BI table..

 

Trying to subtract "ForecastCore3" from CM_Ship Actuals...

Need to use Current Month for "CM_Ship_Actuals" and current month - 3 for "ForecastCore3"

 

Is this possible in DAX?

 

Thanks,

Mike

 

 

6 REPLIES 6
mmarshalek
Frequent Visitor

Thank you! I've tried what you suggested however still now lining correctly....  I had created a calendar table and no success..  Below is the output from my adjustments and I have also include more detailed..

 

 

More detail:Results.jpgmape.jpg

Thanks again!

@mmarshalek

 

Please try to create a calcuated column with following formula.

 

MAPE =
VAR ValueThreeMonthAgo =
    LOOKUPVALUE (
        Table2[ForcastCore3],
        Table2[RecordDate], EDATE ( Table2[RecordDate], -3 ),
        Table2[Businessline], Table2[Businessline]
    )
RETURN
    IF (
        ISBLANK ( ValueThreeMonthAgo ),
        BLANK (),
        ABS ( Table2[CM_Orders_Actual] - ValueThreeMonthAgo )
            / Table2[CM_Orders_Actual]
    )

Calculation of 2 values different dates_1.jpg

 

Best Regards,
Herbert

Hi Herbert,

 

Still having issues...  I'm sure is something simple but just cannot figure it out...  It does not like ProductLine or RecordDate...

 

 

code.PNG

@mmarshalek

 

It seems that you created a measure with my formula. Please try to create a calculated column instead.

 

Best Regards,
Herbert

What are you putting on the rows?   Just the Date like shown?  If so how are you narrowing down the values to a particular product? Slicing by product number?

 

The measure should be quite straightforward:

 

MAPE =
VAR CM_Ship_Actuals =
    SUM ( Table[CM_Ship_Actuals] )
VAR ForecastCore3MoAgo =
    CALCULATE (
        SUM ( Table[ForecastCore3] ),
        PARALLELPERIOD ( Calendar[Date], -3, MONTH )
    )
RETURN
    DIVIDE ( CM_Ship_Actuals - ForecastCore3MoAgo, CM_Ship_Actuals )

 But it depends on what you have in row/column/slicers or other filters...

dearwatson
Continued Contributor
Continued Contributor

Parallel Period should be your friend here:

 

You need contigeous dates for this to work.. if you dont have running dates use a calendar table 🙂

 

Forecast Current = SUM(Table1[Forecast])

Forecast -3 = CALCULATE([Forecast Current],PARALLELPERIOD(Table1[Date],-3,MONTH))

Capture.PNG

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.