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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Create count measure

Hey,

 

I'm trying to create a measure that will count all the numbers at the column, but only those who greater then 0 (the measure will NOT count null cells and 0 number).

 

I tried the CALCULATE function with filter but unfortunately I didnt succeed.

 

The name of the column is "Users".

 

Itay_0-1599636315000.png

 

Thanks for helping! 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello, Im not sure if you'd expect an outcome of 91, or 20 with the shown data; so i made both measures. 

If you'd expect to see 91 (thats the total of the values) you can use:

Measure = SUM(TableUsers[Users])

If you'd expect to see 20 (the count of rows where there is no NULL or 0 you can use:
 

Measure 2 = CALCULATE(COUNT(TableUsers[Users]),TableUsers[Users] > 0)

 

Goodluck,

 

Eric.

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@Anonymous - Try:

Measure = COUNTROWS(FILTER('Table',[Users]<>0))

Measure Distinct Count = COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER('Table',[Users]<>0),"Users",[Users])))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hello, Im not sure if you'd expect an outcome of 91, or 20 with the shown data; so i made both measures. 

If you'd expect to see 91 (thats the total of the values) you can use:

Measure = SUM(TableUsers[Users])

If you'd expect to see 20 (the count of rows where there is no NULL or 0 you can use:
 

Measure 2 = CALCULATE(COUNT(TableUsers[Users]),TableUsers[Users] > 0)

 

Goodluck,

 

Eric.

Anonymous
Not applicable

Yeah that's what I meant,

 

Thanks!

amitchandak
Super User
Super User

@Anonymous , Try like

count of user = countx(summarize(Table,Table[user], "_1", [Measure]+0),[user])
count of user = countx(values(Table[user]),[Measure]+0)

 

 

Just for ref

count of user >0 value= countx(filter(summarize(Table,Table[user], "_1", [Measure]),[_1]>0),[user])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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