Showing results for 
Search instead for 
Did you mean: 
awitt Helper II
Helper II

Filter Table Using Sum

I'm looking to create a measure that counts the number of single line orders in a table. For example, this table would yeild a result of 2 (or list the two order numbers out) since there were only two unique order #'s that only had a single item on the order. 




I had written this but it clearly isn't working...


Single Line Orders = CALCULATE(
             DISTINCTCOUNT(Order #),
                   Sum('Table'[Item Qty) = 1)

Super User III
Super User III

Re: Filter Table Using Sum



try  following Measure


Measure =
    FILTER (
        ALL ( TableName[Order#] ),
        CALCULATE ( COUNT ( TableName[Order#] ) ) = 1
Try my new Power BI game Cross the River
Community Support
Community Support

Re: Filter Table Using Sum

Hi awitt,


For your DAX function, there are two expression errors like picture below, while it can't return the correct result after correct the DAX.


To work the issue, you can follow steps below.


Firstly, you can create intermediate table Count_Table to count distinct Order.




















Then, create measure named Single Line Orders to count the unique order.


Single Line Orders = CALCULATE(COUNT('Table'[Order #]),Count_Table[Count]=1)


Finally, return the result showing picture below.












Here is my test pbix file link:


Best Regards,



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

Helpful resources

New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors