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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
1001
Resolver II
Resolver II

Apply a filter to DIstinctcount of another table

Hi, I wish to wrrite a DAX to apply a FILTER for a table column to a DISTINCTCOUNT of another table. 

 

Essentially, using a table, I wish to count the number of suppliers supplying to three indfividual shops.

 

DISTINCTCOUNT (Table 1 [Suppliers], FILTER (Table 2 [Shop 1]))

 

Any help wold be appreciated. Thanks.  

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @1001 

 

I've simulated some data that I hope fits your situation.

Sample data:

vzhangti_0-1663575858555.pngvzhangti_1-1663576158380.png

Measure = 
CALCULATE (
    DISTINCTCOUNT ( 'Table 1'[Suppliers] ),
    FILTER ( ALL ( 'Table 2' ), [Shop] = "Shop 1" )
)

vzhangti_2-1663576202599.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @1001 

 

I've simulated some data that I hope fits your situation.

Sample data:

vzhangti_0-1663575858555.pngvzhangti_1-1663576158380.png

Measure = 
CALCULATE (
    DISTINCTCOUNT ( 'Table 1'[Suppliers] ),
    FILTER ( ALL ( 'Table 2' ), [Shop] = "Shop 1" )
)

vzhangti_2-1663576202599.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

vanessafvg
Super User
Super User

how are these tables linked?  can you provide some sample data from the tables in text form with a screenshot of what your data looks like?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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