Forum Discussion
Count Rows/Cells based on the Type of Data
Question 1:
How do I count the number rows in a column that do not contain the type number? In other words, I have a column of data with a mix of values that are numbers and values that are not numbers. I want to know how many rows do not contain numbers.
Question 2 (related to the first question):
How do I do the same as above but get the total count for more than one column. In other words, now I have 3 columns of data with a mix of values that are numbers and values that are not numbers. I want to know how many cells do not contain numbers.
Hi Anonymous ,
Try this measure for number 1:
_noofNotNumber = CALCULATE( COUNTROWS(yourTable), ISERROR(VALUE(yourTable[field])) )For number 2, I'd suggest replicating the above measure for each field you want to test and adding them together. If you don't want the extra measures in your model, write the measures as variables in a measure then return VAR1 + VAR2 + VAR3 etc.
Pete
4 Replies
- BA_Pete
Super User
Hi Anonymous ,
Try this measure for number 1:
_noofNotNumber = CALCULATE( COUNTROWS(yourTable), ISERROR(VALUE(yourTable[field])) )For number 2, I'd suggest replicating the above measure for each field you want to test and adding them together. If you don't want the extra measures in your model, write the measures as variables in a measure then return VAR1 + VAR2 + VAR3 etc.
Pete
- AnonymousNot applicable
This worked perfectly. Now I have a follow on question I am hoping you can help with.
If the value returned is zero, the value displayed on the card is (Blank). Is there a way to display zero instead of (Blank)? Or different text like "None"?
- AnonymousNot applicable
Nevermind. I figured this one out. To get zero instead of (Blank) I did the following:
RETURN Var1 + Var2 + 0
Any ideas on how to display "None" instead of "0"?