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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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