The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
I need to be able to count the number of entries in a data column and not count the blanks.
So for example under a column labelled "tag 1" there maybe 25,000 rows but only 150 entries with the other 24,850 rows left blank. I want the count to return 150.
Thanks,
This is an old question, so you may try DISTINCTCOUNTNOBLANK(Table[column]) now
@Anonymous Try COUNTA( )
Here are the other counting functions...
https://msdn.microsoft.com/en-us/library/ee634956.aspx
Already tried COUNTA and it counts all the rows.
@Anonymous, @Sean is correct that if the data in those rows truly was empty that COUNTA should count them the way you describe and COUNTBLANK can be used to determine if they truly are blank.
In the event that there is something in them, like " " or something, the general format would be:
MyMeasure = CALCULATE(COUNT([NumericColumn]),FILTER(SomeTable[SomeColumn] <> ""))
The above formula is essentially the equivalent of COUNTA. The advantage here is that if it is truly not empty (blank) then you can adjust the "" in the formula to something like " ".
Hope you get to the bottom of it.
Thanks but that formula is not working and potentially I'm doing it wrong
Airport Line = CALCULATE(count('EngagorData'[Tag-L3 » Airport Line]),FILTER('EngagorData','EngagorData'[Tag-L3 » Airport Line]<>""))
Above is the formula I used and it returns nothing.
In your formula you reference to "numericcolumn and sometable some column. am i missing something.
My data table is call "EngagorData" and the column is called "Tag-L3 » Airport Line". In each cell it is either blank or has the entry "Tag-L3 » Airport Line"
I have even tried this and returns nothing.
Airport Line = CALCULATE(count('EngagorData'[Tag-L3 » Airport Line]),FILTER('EngagorData','EngagorData'[Tag-L3 » Airport Line]="Tag-L3 » Airport Line"))
What numbers do you get from each of these
COUNTROWS( ), COUNTA( ), COUNT( ) and COUNTBLANK( )
and what DATA TYPE is the column?
Got it working
Measure = COUNTA('EngagorData'[Tag-L3 » Airport Line]) - COUNTBLANK('EngagorData'[Tag-L3 » Airport Line])
I like to recommend that you use the query editor to clean your tables before loading them into the data model.
If a blank that isn't blank creates problems already at this stage, there's quite a likelihood that it will produce other errors as well later on - maybe some of them that will not as easily be spotted as this one.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Okay - so what does COUNTBLANK( )give you then? You are creating Measures right?