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

Group Sum Greater Than and Distinct Counts

For the data set below, I am looking for a DAX formula that will sum each of the Line Amount fields by Document No_ and return the sum of Document No_ aggregates greater than $5,000.

 

The desired total would be $20,295.

 

I would also like a DAX formula that returns the distinct count of Document Nos aggregates greater than $5,000.  In this example, returning 2 as the value.

 

Snip PowerBI Question.JPG

 

 

1 ACCEPTED SOLUTION
dedelman_clng
Community Champion
Community Champion

AggSumOver5K =
CALCULATE (
    SUMX (
        FILTER (
            SUMMARIZE ( Table2, Table2[DocNo], "Aggregate", SUM ( Table2[LineAmt] ) ),
            [Aggregate] > 5000
        ),
        [Aggregate]
    )
)
CountOver5K =
CALCULATE (
    COUNTROWS (
        FILTER (
            SUMMARIZE ( Table2, Table2[DocNo], "Aggregate", SUM ( Table2[LineAmt] ) ),
            [Aggregate] > 5000
        )
    )
)

Capture.PNG

 

Hope this helps,

David

View solution in original post

2 REPLIES 2
dedelman_clng
Community Champion
Community Champion

AggSumOver5K =
CALCULATE (
    SUMX (
        FILTER (
            SUMMARIZE ( Table2, Table2[DocNo], "Aggregate", SUM ( Table2[LineAmt] ) ),
            [Aggregate] > 5000
        ),
        [Aggregate]
    )
)
CountOver5K =
CALCULATE (
    COUNTROWS (
        FILTER (
            SUMMARIZE ( Table2, Table2[DocNo], "Aggregate", SUM ( Table2[LineAmt] ) ),
            [Aggregate] > 5000
        )
    )
)

Capture.PNG

 

Hope this helps,

David

It works.  Thanks so much!

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.