Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello everyone,
I have a database that stores the boolean values of a field that was collected. I am trying to count the frequency that the value appears i.e. the strucutre looks something like this:
Element A | Element B
True | False
True | False
False | True
With this I would like to be able to determine that Element A is True twice and False once etc. I have been trying to use measures without much sucess or knowing the functions to use.
Solved! Go to Solution.
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.
There is a simplest way to write the formula, and in my opinion, it is easy to read and understand.
COUNTROWS(FILTER(Table; Table[Element A] = TRUE()))
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.
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".
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.
Hi,
My scenario is something similar but I have many conditions. Like below
if category="Good" then count(Column)
else if category = "bad" then count(Column)
else if category ="neutral" then count(Column)
else
blank()
END
How do i do this?
I tried it with if and switch condition but its not working.
CheckCount =
IF([Category]="Danger",COUNT(Table1[Column1]),
IF([Category]="Bad",COUNT(Table1[Column1]),
IF([Category]="Good",COUNT(Table1[Column1]),
IF([Category]="Neutral",COUNT(Table1[Column1]),
IF([Category]="very Good",COUNT(Table1[Column1])
,BLANK())
) ) ) )
And this category is a measure which I have made. But now i just want a count of these categories so i can make some pie ot donought chart.
Thank you,
Bhavana
Worked like a charm for me! Thanks!!!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
97 | |
69 | |
46 | |
39 | |
33 |
User | Count |
---|---|
159 | |
107 | |
61 | |
51 | |
40 |