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
Azou
Regular Visitor

Daxe issue

Hi, I need help with a DAX issue. I have a table with the following columns: YEAR MONTH, ACTUALS, and FORECAST. The YEAR MONTH table is composed as follows: 23-01; 23-02; ... ; 23-12 ; 23-01; 23-02; ... ; 23-12... And the news column has values from 23-01 to 24-02. The Forecast column has values for all months of each year. I want to calculate the sum of the actuals, but if for example there are months when the actuals are not available for a few months be replaced in the calculation of the sum by their values in Forecast. Here's a screenshot of my table. Here is the formul : 

Act = CALCULATE(sum(MasterFacts[Value]),MasterFacts[Scenario]="Actuals")
Fcst = CALCULATE(sum(MasterFacts[Value]),MasterFacts[Scenario]="Forecast")
LE MTD =
    CALCULATE(
        IF (
            SELECTEDVALUE(MasterFacts[StartDate]) <= DATE(YEAR(TODAY()), MONTH(TODAY()) - 1, DAY(TODAY())),
            [Act],
            [Fcst]
        )
    )
LE FY = CALCULATE([LE MTD],ALLEXCEPT(Dates,Dates[Date]))
7 REPLIES 7
JamesFR06
Resolver IV
Resolver IV

HI

Measure=

var Lastdatewithactuals= CALCULATE(max(MasterFacts[StartDate]),MasterFacts[Scenario]="Actuals")

 

Var Act = CALCULATE(sum(MasterFacts[Value]),MasterFacts[Scenario]="Actuals")
Var Fcst = CALCULATE(sum(MasterFacts[Value]),MasterFacts[Scenario]="Forecast")

VAR RemainingForecast =

    CALCULATE (

        [Fcst],

        KEEPFILTERS ( MasterFacts[Value] > Lastdatewithactuals)

var Actualandforecast=Act+Remainingforecast

return 

calculate(Actualandforecast,datesytd(date[date]))

Hi, thanks for your reply. Yes, the formula you sent me works well but it comes out of LE MTD in my table. What I want is to have a new measure column that will have as its value the sum that I have framed in red on the image load previously

Hi,

The measure I sent you id oding actuals and forecast. Please check

Salut, Oui désolé. C’est vrai, mais j’avais déjà calculé cette mesure. Je ne sais pas si vous avez compris ma question sur le post précédent.

Donc elle fonctionne, normalement elle prend les actuals jusqu'au dernier jour ensuite elle ajoute le forecast

 

Yes. But that's not what I want right now

DOnc je ne comprends paq ce que tu veux désolé

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.