Forum Discussion
Count the frequency of a boolean value
- 9 years ago
Hey,
Last night I had a brainwave and jumped out of bed and got it working using the following formula:
TrueCount = COUNTAX(FILTER('Table',[Element_A]=TRUE()),TRUE())Thanks for the additional inputs as well, I will have a play with those other suggestions to see how else I might be able to solve the problem.
You do not need measures for this. You could do this in a table visualization by adding Element A and then Count of Element B or Count of Element A.
If you wanted a measure, you could do something like:
TrueCount = CALCULATE(COUNT([Element A]),FILTER(Table,[Element A] = "True"))
Shouldn't that be more something like:
TrueCount = Calculate(COUNTROWS('Table'),'Table'[Element A])This assumes that Element A has only true and false values.
- Greg_Deckler9 years ago
Community Champion
Well, depends on whether his true/false columns are text or boolean. You can't directly COUNT true/false columns if that's what he has. You can solve that by adding in Index field in the query and counting that instead but either method should work. And using the TRUE() function in place of "True".
- walkeras9 years ago
Advocate I
Hey,
Last night I had a brainwave and jumped out of bed and got it working using the following formula:
TrueCount = COUNTAX(FILTER('Table',[Element_A]=TRUE()),TRUE())Thanks for the additional inputs as well, I will have a play with those other suggestions to see how else I might be able to solve the problem.
- wmjhca7 years agoFrequent Visitor
Worked like a charm for me! Thanks!!!