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
dandywong
Frequent Visitor

calculate distinct count filter by not zero

Hi there,

 

I'm trying to figure out how to calculate, distinct count and filter based on a column having a value >= 1.

 

How can I filter out the rows based on there not being a value in the column? Basically, if the cell IS BLANK, then it should show up in this table.

 

 Image

6 REPLIES 6
v-lili6-msft
Community Support
Community Support

hi, @dandywong

     It seems that you want to distinct count by Grouping。

You may try to use EARLIER Function in your formula

for example

Count 2 = CALCULATE(DISTINCTCOUNT(Table2[Column2]),FILTER(Table2,NOT(ISBLANK(Table2[Column2]))))
Count 3 = CALCULATE(DISTINCTCOUNT(Table2[Column2]),FILTER(Table2,Table2[Column1]=EARLIER(Table2[Column1])&&NOT(ISBLANK(Table2[Column2]))))

Result:

7.PNG

 

If not your case, please share your sample pbix and expected output for us. You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.

 

 

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
dandywong
Frequent Visitor

Sorry, if cell IS BLANK, it should not show up in this table

You will want to use something like

 

FILTER(Tab, NOT(ISBLANK(Tab[blankable column])

 

as a parameter on CALCULATE.

 

Also, be aware that sometimes a value is BLANK, sometimes it is just ""

 

Hope this helps.

David

Thanks @ dedelman_clng, but it did something weird with  the count of the column or did I not get the script right?

 

Capture2.PNG

It looks like you're trying to create this as a calculated column instead of a measure. Try recreating as a measure and build a table visual instead of using the data preview.

 

Other than that we would need to see more of your model, data, etc to help troubleshoot further. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

 

dandywong
Frequent Visitor

Capture.PNG

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
Top Kudoed Authors