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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
arpost
Post Prodigy
Post Prodigy

Help! Anyone have a DAX solution for summing values based on dates in a different table?

Greetings, community! Hope someone can help me figure out this DAX scenario. I've tried just about everything of which I can think (SUMX, Calculate, SelectedValue, etc.), and can't figure out a solution. It seems like this should be simple, but it is driving me crazy! Let me set the stage with a "simplified" example.

Scenario

I have a matrix with a date from one table and need to show the total $ in that window of time in another table.

arpost_9-1662559590795.png


Here's the sample data from the three tables:

arpost_19-1662562398305.png

 

And here is the data model:

arpost_20-1662562489922.png

 

Desired Result

What I'm hoping to achieve is that, when I single-select slice to a specific category, the matrix will show the total $ that was paid based on each account's Start/End Date range. So, based on the data, New Accounts that had a StartDate in June would show $3000 for New Accounts.

 

arpost_17-1662562302920.png

 

When sliced to Returning Accounts, it would show June with $600 (All Payments for Account #1 >= StartDate 6/21) and August with -$1500.

 

arpost_18-1662562307135.png

 

Does anyone have a brilliant idea or suggestion?

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @arpost ,

 

vchenwuzmsft_0-1662619881302.gif

 

Measure:

Measure =
VAR _s =
    SUMMARIZE (
        'DateSummary',
        [AcountKey],
        [StartDate],
        [EndDate],
        "amount",
            CALCULATE (
                SUM ( OrderSummary[Amount] ),
                FILTER (
                    OrderSummary,
                    [AccountKey] = DateSummary[AcountKey]
                        && [TransactionDate] >= [StartDate]
                        && IF ( ISBLANK ( [EndDate] ), TRUE (), [TransactionDate] <= [EndDate] )
                )
            )
    )
RETURN
    SUMX (
        _s,
        [amount]
    )

 


Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

1 REPLY 1
v-chenwuz-msft
Community Support
Community Support

Hi @arpost ,

 

vchenwuzmsft_0-1662619881302.gif

 

Measure:

Measure =
VAR _s =
    SUMMARIZE (
        'DateSummary',
        [AcountKey],
        [StartDate],
        [EndDate],
        "amount",
            CALCULATE (
                SUM ( OrderSummary[Amount] ),
                FILTER (
                    OrderSummary,
                    [AccountKey] = DateSummary[AcountKey]
                        && [TransactionDate] >= [StartDate]
                        && IF ( ISBLANK ( [EndDate] ), TRUE (), [TransactionDate] <= [EndDate] )
                )
            )
    )
RETURN
    SUMX (
        _s,
        [amount]
    )

 


Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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