cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
patrisack Frequent Visitor
Frequent Visitor

DAX Sum of Budget if Actual-Month available

Hi!

I'm having issues with creating a measure for estimated end-of-month results - taking actuals up to a selected date and using forecast-data for the remainder of the month.

 

I've created an example of what I want to do in this Excel-file. I want to replicate the formula there to DAX so I can use it in my report. Hopefully someone in this

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
v-jiascu-msft Super Contributor
Super Contributor

Re: DAX Sum of Budget if Actual-Month available

Hi @patrisack,

 

Please check out the demo in the attachment. 

Column =
VAR currentDatum = [Datum]
RETURN
    CALCULATE (
        SUM ( Table1[Actuals] ),
        FILTER (
            'Table1',
            Table1[Datum] <= currentDatum
                && Table1[Datum]
                    >= ( EOMONTH ( currentDatum, -1 ) + 1 )
        )
    )
        + CALCULATE (
            SUM ( Table1[Forecast] ),
            FILTER (
                Table1,
                Table1[Datum] > currentDatum
                    && Table1[Datum] <= EOMONTH ( currentDatum, 0 )
            )
        )

DAX_Sum_of_Budget_if_Actual_Month_available

Note: your data is random. The result of [Column] here is correct.

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-jiascu-msft Super Contributor
Super Contributor

Re: DAX Sum of Budget if Actual-Month available

Hi @patrisack,

 

Please check out the demo in the attachment. 

Column =
VAR currentDatum = [Datum]
RETURN
    CALCULATE (
        SUM ( Table1[Actuals] ),
        FILTER (
            'Table1',
            Table1[Datum] <= currentDatum
                && Table1[Datum]
                    >= ( EOMONTH ( currentDatum, -1 ) + 1 )
        )
    )
        + CALCULATE (
            SUM ( Table1[Forecast] ),
            FILTER (
                Table1,
                Table1[Datum] > currentDatum
                    && Table1[Datum] <= EOMONTH ( currentDatum, 0 )
            )
        )

DAX_Sum_of_Budget_if_Actual_Month_available

Note: your data is random. The result of [Column] here is correct.

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

patrisack Frequent Visitor
Frequent Visitor

Re: DAX Sum of Budget if Actual-Month available

Thank you for the quick reply! Smiley Happy

patrisack Frequent Visitor
Frequent Visitor

Re: DAX Sum of Budget if Actual-Month available

@v-jiascu-msftAny chance you could also formulate the calculation as a measure instead of a calculated column?

 

Thank you!

v-jiascu-msft Super Contributor
Super Contributor

Re: DAX Sum of Budget if Actual-Month available

Hi @patrisack,

 

Try this one, please.

 

Measure =
CALCULATE (
    SUM ( Table1[Actuals] ),
    FILTER (
        ALL ( Table1 ),
        'Table1'[Datum] <= MIN ( 'Table1'[Datum] )
            && 'Table1'[Datum]
                >= EOMONTH ( MIN ( 'Table1'[Datum] ), -1 ) + 1
    )
)
    + CALCULATE (
        SUM ( Table1[Forecast] ),
        FILTER (
            ALL ( 'Table1' ),
            'Table1'[Datum] > MIN ( 'Table1'[Datum] )
                && 'Table1'[Datum] <= EOMONTH ( MIN ( 'Table1'[Datum] ), 0 )
        )
    )

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 47 members 873 guests
Please welcome our newest community members: