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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
StidifordN
Helper III
Helper III

Distinct Count of Column per another column - respecting slicers

I have a requirement to include a disctinct count per another column, but both columns need to exist in the table.

The scenario is - i have multiple suppliers servicing 1 or multiple client accounts - i want to get a distinct count of Client Accounts serviced per supplier - but I require both the Supplier and Client account in the table, whilst having the table still respect any slicers selected on the report page.

 

Sample output table below -

Output 1 being the distinct count of Accounts that exist per Supplier
Output 2 will be a simple if Output 1 > 1 then Yes, otherwise No.

 

AccountSupplierOutput 1Output 2
Account 1Supplier ABC3Yes
Account 1Supplier DEF1No
Account 1Supplier GHI1No
Account 2Supplier JKL1No
Account 3Supplier ABC3Yes
Account 3Supplier MNO2Yes
Account 4Supplier ABC3Yes
Account 4Supplier MNO2Yes

 

I have attempted measures with distinctcount and allexcept(supplier) - but this then ignores any page filters applied, and for this report they are critical.

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @StidifordN,

I would suggest:

Output 1 = 
CALCULATE (
    DISTINCTCOUNT ( YourTable[Account] ),
    ALLSELECTED ( ),
    VALUES ( YourTable[Supplier] )
)
  • ALLSELECTED ( ) restores the outer or "overall" filter context of the visual.
  • VALUES ( YourTable[Supplier] ) retains the visible Supplier on a given "row" of the visual as a filter.
  • The intersection of these should give the result you want.

 

Does this work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

4 REPLIES 4
Bibiano_Geraldo
Super User
Super User

Hi @StidifordN ,

Create one measure for output 1:

Output 1 = 
CALCULATE(
  DISTINCTCOUNT( YourTable[Account] ),
  ALLSELECTED( YourTable[Account] )
)

 

Now create a measure for output 2 :

Output 2 = 
IF( [Output 1] > 1, "Yes", "No" )

 

Drag the field for the table visual, and your finaly output will look like this:

Bibiano_Geraldo_0-1746182153778.png

 

v-kpoloju-msft
Community Support
Community Support

Hi @StidifordN
Thank you for reaching out to the Microsoft fabric community forum. Thank you @OwenAuger, for your inputs on this issue.

After thoroughly reviewing the details you provided, I was able to reproduce the scenario, and it worked on my end. I have used it as sample data on my end and successfully implemented it.    

Dax Measure for Output 1 in table:

Output 1 =

CALCULATE(

    DISTINCTCOUNT('Table'[Account]),

    REMOVEFILTERS('Table'[Account])

)

Dax Measure for Output 2 in table:

Output 2 =

IF([Output 1] > 1, "Yes", "No")

Outcome:

vkpolojumsft_0-1746177440105.png

I am also including .pbix file for your better understanding, please have a look into it:

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using Microsoft Community Forum.

OwenAuger
Super User
Super User

Hi @StidifordN,

I would suggest:

Output 1 = 
CALCULATE (
    DISTINCTCOUNT ( YourTable[Account] ),
    ALLSELECTED ( ),
    VALUES ( YourTable[Supplier] )
)
  • ALLSELECTED ( ) restores the outer or "overall" filter context of the visual.
  • VALUES ( YourTable[Supplier] ) retains the visible Supplier on a given "row" of the visual as a filter.
  • The intersection of these should give the result you want.

 

Does this work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

THIS is the solution - many thanks.  Worked like a charm.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors