Forum Discussion
Count rows with condition
- 3 years ago
Right, we have each individual call in the table so, to get what you want in one measure, we need to :
create a variable that represents a table with each outlet and the COUNT of calls (that's what you have in the table visual in the original post).
var _tb = SUMMARIZECOLUMNS(TableCalls[OutletID], "numCalls", COUNT(TableCalls[Message]))and then
we need to FILTER this table to get only rows where the count is greater than 100 and we COUNT those rows.
All this is in a measure. I leave you to complete the RETURN statement.
Also, change the table, column names to suit your data.
--
If you get stuck, I will help
- Anonymous3 years ago
Hi Anonymous ,
Do you mean counting the number of outlets with messages over 100?
Please try this measure:
CountMeasure = var _a = CALCULATE(DISTINCTCOUNT('Table'[Outletld]),FILTER('Table',CALCULATE(DISTINCTCOUNT('Table'[MessageOid]),FILTER('Table',[Outletld]=EARLIER('Table'[Outletld])))>100)) return _aThen the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Right, we have each individual call in the table so, to get what you want in one measure, we need to :
create a variable that represents a table with each outlet and the COUNT of calls (that's what you have in the table visual in the original post).
var _tb = SUMMARIZECOLUMNS(TableCalls[OutletID], "numCalls", COUNT(TableCalls[Message]))
and then
we need to FILTER this table to get only rows where the count is greater than 100 and we COUNT those rows.
All this is in a measure. I leave you to complete the RETURN statement.
Also, change the table, column names to suit your data.
--
If you get stuck, I will help