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.
I would like to count the number of cells in a numeric column but exclude if the value is 0. Seems like this should be fairly easy, but since I am new to PowerBI, I would appreciate any assistance! Thank you!
Solved! Go to Solution.
Yep that's another way of doing the same thing...
the only thing I'll change is add the table name as per Rob Collie's post here
EDIT: Sorry the post was actually by @MattAllington on Rob's site
But that's just a suggestion it should work regardless
Count Column = COUNTX ( FILTER ('Table', 'Table'[Column] <> 0) , 'Table'[Column] )
Hey @dlgardo,
Create a new column like the one below:
Count Column = SUMX([Dataset], IF([Column1]<>0, 1, 0))
This will count all the fields that are not equal to 0.
Hope this helps,
Alan
Here's an alternative
Column Count Measure = CALCULATE ( COUNTROWS('Table'), 'Table'[Column] <> 0 )
The above is basically internally treated like this...
Column Count Measure = CALCULATE ( COUNTROWS('Table'), FILTER ( 'Table', 'Table'[Column] <> 0 ) )
Also if for some reason you neeed to exclude the zeros but include the blanks just add the countblank like this
Column Count Measure = CALCULATE ( COUNTROWS('Table'), 'Table'[Column] <> 0 ) + COUNTBLANK ( 'Table'[Column] )
Yep that's another way of doing the same thing...
the only thing I'll change is add the table name as per Rob Collie's post here
EDIT: Sorry the post was actually by @MattAllington on Rob's site
But that's just a suggestion it should work regardless
Count Column = COUNTX ( FILTER ('Table', 'Table'[Column] <> 0) , 'Table'[Column] )
Thank you very much for the reply! Seems like that is counting every cell in the table. I just need a count of rows based on a column if the value is not 0. I have a total of about 86000 rows, and the number of rows that do not have a 0 value in Column F should come down to approx. 24K.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
142 | |
108 | |
101 | |
81 | |
74 |