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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Phunt
New Member

How to create Sumifs in Date table with Dax

I have a data of trading like A1:G3 with the trade volume from date to date. Now i want to get the outstanding balance at the end of each day between that time. In excel i use Sumifs. Expected results as in A6:B11. Can you help to create in PBI?

8F410DF7-87B4-490F-9EEE-BD8ED084F2CA.jpeg

2 REPLIES 2
v-zhengdxu-msft
Community Support
Community Support

Hi @Phunt 

 

Please try this:

First of all, I create a sample table:

vzhengdxumsft_0-1711593813105.png

Then add a new table:

Table 2 =
VAR _newtable =
    FILTER (
        CROSSJOIN ( CALENDAR ( "2024-1-1", "2024-1-5" ), 'Table' ),
        [Date] < MAX ( 'Table'[Value Date] )
            && 'Table'[Value Date] <> MAX ( 'Table'[Value Date] )
            && 'Table'[Mat Date] > [Date]
            || [Date] >= MAX ( 'Table'[Value Date] )
                && 'Table'[Value Date] = MAX ( 'Table'[Value Date] )
                && 'Table'[Mat Date] > [Date]
    )
RETURN
    SELECTCOLUMNS (
        _newtable,
        [Date],
        "Outstanding Amt",
            IF (
                [Date] >= MAX ( 'Table'[Value Date] ),
                MAX ( 'Table'[Amt] ) + MIN ( 'Table'[Amt] ),
                'Table'[Amt]
            )
    )

 The result is as follow:

vzhengdxumsft_1-1711593865305.png

 

Best Regards

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

Thank you @ Zhendong Xu. but my actual data having thousands line (trade date - its may be years) so cannot using like this, right?

I have a Date Table, i would like to add a columm on this Date Table and using Dax on the colum, but its not workable. Can you help

Phunt_0-1711596009791.png

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors