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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.