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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
PowerIBM
Frequent Visitor

Swapping Previous month's forecasts with that same month's actuals but YTD is wrong

I've got two attributes, i.e., forecasts and actual sales. When a month passes, my dax replaces forecast values with actual sales values. If we talk about MTD of forecast, it's working fine, but when it comes to YTD, it reflects the total of forecast by considering its own original values and doesn't account for the replaced values for the total.

 

My DAXs are as follows:

 

OpEx_AOP =
VAR _AOP =
SWITCH([Calendar Order],
0, [AOP Selected Value],
1, CALCULATE([AOP Selected Value], DATESQTD('Date Table'[Date])),
2, CALCULATE([AOP Selected Value], DATESYTD('Date Table'[Date])))
RETURN
_AOP
 
OpEx_AOP_F =
IF(MAX('Date Table'[date]) < (DATE(YEAR(TODAY()), MONTH(TODAY()), 1) -1),[ACT_Currency],PLAN_OpEx[OpEx_AOP])
 
PowerIBM_0-1681448127174.png


What could be the solution for this?

1 REPLY 1
johnt75
Super User
Super User

I think its failing because the max date is being calculated at the total level, and you need to calculate it at the daily level. Try

OpEx_AOP =
VAR _AOP =
    SWITCH (
        [Calendar Order],
        0, [AOP Selected Value],
        1, SUMX ( DATESQTD ( 'Date Table'[Date] ), [AOP Selected Value] ),
        2, SUMX ( DATESYTD ( 'Date Table'[Date] ), [AOP Selected Value] )
    )
RETURN
    _AOP

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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