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
Anonymous
Not applicable

Help with Distinct Count

Hi, 

 

I am trying to write some DAX to get the distict count of SKUs that have a certain threshold of CM%. I have a measure calculating CM % and a measure calculating the distinctcount of SKUs in the full table. The formula works if I use rowcount but when I used distinctcount, the formula doesnt work...

 

CountofSKUsnegCM% = CALCULATE(DISTINCTCOUNT(Data[SKU]),[CM%]<0) gets an error of A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
 
Any idea how to solve this?
2 REPLIES 2
Ritaf1983
Super User
Super User

Hi @Anonymous 
Modify your formula by adding the "filter" function.
Something like :
CountofSKUsnegCM% = CALCULATE(DISTINCTCOUNT(Data[SKU]), filter (your table,[CM%]<0))In case it still doesn't work out,

please attach your table and the desired result.

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Anonymous
Not applicable

Hi!

 

Thanks for the help! It accepts the formula (no error) but when i drop it into a card it is showing as blank. Not sure why that would be... heres the updated formula:

 

CountofSKUsnegCM% = CALCULATE(DISTINCTCOUNT(Data[SKU]),FILTER(Data,[CM%]<0))
 
Here is the table that the number should reflect with the associated filters applied (CM<0)
 
jakerussell406_0-1685036312018.png

 

The count measure above is:

 

CountofSKUs = DISTINCTCOUNT(Data[SKU])
 
Let me know if you need anything else!

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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