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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
RYU209
Helper III
Helper III

Count distinct rows based off one column and add filters WITHOUT Calculate? (Direct Query)

Hello,

I'm trying to count the distinct values in a column with filters without using CALCULATE because I am using a Direct Query. 

So far I have COUNTROWS(FILTER(Table, Table[A] = "1")) which counts every row with the filter condition but I'm not sure how to make it filter only on the distinct values in a given column as well. 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

@RYU209 
Please try

=
COUNTROWS (
    DISTINCT (
        SELECTCOLUMNS (
            FILTER (
                'Table',
                'Table'[A] = "1"
            ),
            "@B", 'Table'[B]
        )
    )
)

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

@RYU209 
Please try

=
COUNTROWS (
    DISTINCT (
        SELECTCOLUMNS (
            FILTER (
                'Table',
                'Table'[A] = "1"
            ),
            "@B", 'Table'[B]
        )
    )
)

That worked perfectly. Thank you!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.