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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
FVZ
Frequent Visitor

DistinctCount ONLY the lowest values of a column in case of multiple rows

I'm looking for a DAX calculation which does DISTINCTCOUNT with a certain condition. If a Customer has two different Priorities, it should only do a count on the lowest Priority. To demonstrate with dummy data:

 

Customer Priority

Jan5
Tom2
Dirk6
Jan1

 

You see that Customer Jan has two rows, one with Priority 5 and 1. In this case I want to DISTINCTCOUNT the Customer only for the lowest Priority, being 1 in this case. The end result should look as follows. 

 

FVZ_0-1730885277805.png

 

Thanks in advance!!

 

1 ACCEPTED SOLUTION
shafiz_p
Super User
Super User

Hi @FVZ  Try this:

 

DistinctCountLowestPriority = 
CALCULATE(
    COUNT('Table'[Customer]),
    FILTER(
        'Table',
        'Table'[Priority] = CALCULATE(MIN('Table'[Priority]), ALLEXCEPT('Table', 'Table'[Customer]))
    )
)

 

Output:

shafiz_p_0-1730887850975.png

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz

View solution in original post

6 REPLIES 6
shafiz_p
Super User
Super User

Hi @FVZ  Try this:

 

DistinctCountLowestPriority = 
CALCULATE(
    COUNT('Table'[Customer]),
    FILTER(
        'Table',
        'Table'[Priority] = CALCULATE(MIN('Table'[Priority]), ALLEXCEPT('Table', 'Table'[Customer]))
    )
)

 

Output:

shafiz_p_0-1730887850975.png

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz

FVZ
Frequent Visitor

Had to change COUNT to DISTINCTCOUNT but worked like a charm, thank you sir!

johnt75
Super User
Super User

Just do a distinct count of the customer, that will only count them once no matter how many times they appear in the table.

FVZ
Frequent Visitor

That's the thing, I don't want to just do a Distinct Count of the Customer because then a Customer with two rows will be counted twice (in this case in Priority 5 and 1). While I only want it to be counted once, for the lowest Priority (1). 

That's not how a distinct count works, that's how a count works. A count would return 2 for a customer with 2 rows, a distinct count will only return 1 for a customer no matter how many times they appear.

FVZ
Frequent Visitor

That's true yes. But as I said, I want to return 1 for a Customer which appear twice in the data (in Priority 5 and 1). Distinct Count returns a 1 for both the Priorities, but I only want to return it for the lowest Priority. So not with Priority 5. 

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.