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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Krijgersss
Helper II
Helper II

distinctcount with a related filter function

Hello i need some help 

i want to make a formule for distinctcount with a related function because i need to filter my distinctcount from a related table (see screenshot)

Krijgersss_0-1711451985778.png

 

6 REPLIES 6
Anonymous
Not applicable

@QuentinBl & @tamerj1  Thanks for your contribution on this thread.

Hi @Krijgersss ,

@QuentinBl  and @tamerj1 have provided you some suggestions, but it seems that can't help you get the expected result. Could you please provide some fake data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

tamerj1
Super User
Super User

Hi @Krijgersss 

you can

Public Holidays =
SUMX (
    Dim_Emplyee,
    CALCULATE (
        COUNTROWS ( Public_Holidays ),
        USERELATIONSHIP ( Public_Holidays[Country], Dim_Employee[CountryCode] )
    )
)

i tried this but this gives me the same result it doesnt let the filter function work. it's the way the model is build i need to count from a dimension table and i need to filter from a fact tabel i tried using crossfilter but this gives me extreem loeding times and wrong values

@Krijgersss 

Please ignore my above solution. I have edited it by mistake and pasted a solution that was intended for another question in the forum. 

I remember my original solution included summarizing the fact table by the dimension column. That should work unless there are more information that need to be provided. If you have an active one to many single direction relationship between the two tables, normally this should work. 

QuentinBl
Helper I
Helper I

Hello @Krijgersss , 

The easiest way is maybe to modify your relationship to allow filtering in both direction ? 
becareful, it can alter your model functionnality or performances. 

If only your disctinctcount need this filter, you can use a DAX Crossfilter function to modify your relationship in a specific measure.






i tried using crossfilter but this gives me extreem loeding times and wrong values is also tried using it in my measure but that also doesnt work. it's because of the model is build i need to distinctcountnoblank on a dimension table and a filter from a fact table

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.