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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

How to use distinctcountnoblank for expression

Hi,

 

I would like to know how to use DISTINCTCOUNTNOBLANK on an expression which performs a rowwise calculation on a column instead of directly on the column itself. I cannot create a calculated column because the data model is fixed.

 

COUNTAX works well in capturing the expression but cannot identify distinct values, and DISTINCT functions require a column.

 

I am using CALCULATE(COUNTAX(table, expr), FILTER(table, filter)) currently and would like to count only distinct results from the expression.

2 REPLIES 2
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

Based on tested, when use this DISTINCTCOUNTNOBLANK Function in a measure for the expression, it's result seems incorrect. As a workaround, you can create a measure as below.

 

expr = CALCULATE(DISTINCTCOUNT(Table1[letter]),FILTER(ALL(Table1),Table1[letter]<>BLANK()))

 

Best Regards,

Amy

 

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

 

Anonymous
Not applicable

Hi @v-xicai ,

 

I am still unable to use an expression (measure) with the DISTINCTCOUNT function as it demands a column instead.

 

Also, I would need to filter on another filter other than the noblanks filter.

 

Could you advise on how to resolve these two issues as well using a DAX?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.