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
Anonymous
Not applicable

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
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

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

5 REPLIES 5
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

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.
Anonymous
Not applicable

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

 

Thank you!

Hi @Anonymous,

 

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.
Anonymous
Not applicable

I would like to apply a filter every month like 
Ie, For example if I select May month, It should display like this for me = 

Cumulative May=
Var April = CALCULATE(SUM(new_shptransactionscurrentyears[new_netbalance]), new_shptransactionscurrentyears[new_postingdate].[monthNo] = 4)
Var May = CALCULATE(SUM(new_shptransactionscurrentyears[new_netbalance]), new_shptransactionscurrentyears[new_postingdate].[monthNo] = 5)
return (April + May)



Help is greatly appreciated 
Anonymous
Not applicable

Thank you for the quick reply! Smiley Happy

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.