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
KevinVertrees
Frequent Visitor

Help with Dax formula for financial format

I'm having difficultly with a Dax formula related to some financial data that i'm trying to work with.  The table below is a sample of the data I'm working with.  The table includes a beginning_balance, which reflects the opening year balance for period 1, and then the starting balance for each period.  What i'm trying to achieve is to allow the user to select a date range (say Q1/2020) and have a formula that includes the beginning_balance + Period_Actuals for the first month of the date range, and then include only the period_actuals for the dates after the first date.  The formula I've developed (which isn't working) is

 

YTD Actual = CALCULATE(SUMX('Financial Balances', if('Financial Balances'[Date]<=[FirstMonth], 'Financial Balances'[Beginning_Balance]+'Financial Balances'[Period_Actuals],'Financial Balances'[Period_Actuals]) ),ALLSELECTED('Calendar'))

 

PropertyAccountDateBeginning_balancePeriod_ActualsCurrent ResultDesired Result
1001buck120500101/1/2020-295279.12-15.88-15.88
1001buck120500102/1/2020-15.88-307-322.88-307
1001buck120500103/1/2020-322.88224-98.88224

 

Any help would be greatly appreciated!

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @KevinVertrees ,

 

Try this:

YTD Actual =
VAR FirstMonth =
    EOMONTH ( MINX ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] ), 0 )
RETURN
    SUMX (
        'Financial Balances',
        IF (
            'Financial Balances'[Date] <= FirstMonth,
            'Financial Balances'[Beginning_balance] + 'Financial Balances'[Period_Actuals],
            'Financial Balances'[Period_Actuals]
        )
    )

YTD.PNG

 

 

Best Regards,

Icey

 

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

2 REPLIES 2
Icey
Community Support
Community Support

Hi @KevinVertrees ,

 

Try this:

YTD Actual =
VAR FirstMonth =
    EOMONTH ( MINX ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] ), 0 )
RETURN
    SUMX (
        'Financial Balances',
        IF (
            'Financial Balances'[Date] <= FirstMonth,
            'Financial Balances'[Beginning_balance] + 'Financial Balances'[Period_Actuals],
            'Financial Balances'[Period_Actuals]
        )
    )

YTD.PNG

 

 

Best Regards,

Icey

 

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

amitchandak
Super User
Super User

@KevinVertrees , Not very clear. But you have few functions that can help

 

openingbalancemonth,openingbalancequarter, openingbalanceyear, firstnonblankvalue
closingbalancemonth ,closingbalancequarter, closingbalanceyear and lastnonblankvalue

 

Refer the document how the work.

If these are useful, you can watch video :https://youtu.be/yPQ9UV37LOU

https://youtu.be/6lzYOXI5wfo

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.