Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi Everyone,
I'm trying to calculate a percentage. My column consists of YES, NO and NA. What i want to calculate is just NO/(YES + NO).
How can i do this in PowerBI?
Thank you!
Solved! Go to Solution.
Hi @DataAnalyst13 , Try this:
Result = var count_of_NO = Calculate(count([columnname]), FILTER(tablename, [columnname]="NO"))
var count_of_YES = Calculate(count([columnname]), FILTER(tablename, [columnname]="YES"))
var total =count_of_NO + count_of_YES
RETURN
DIVIDE(count_of_NO, total)
If you wish to include NA too in the toal then you can use this:
var total = count([columnname])
@DataAnalyst13 -> Please hit the thumbs up & mark it as a solution if it helps you. Thank you.
Hi @DataAnalyst13 , Try this:
Result = var count_of_NO = Calculate(count([columnname]), FILTER(tablename, [columnname]="NO"))
var count_of_YES = Calculate(count([columnname]), FILTER(tablename, [columnname]="YES"))
var total =count_of_NO + count_of_YES
RETURN
DIVIDE(count_of_NO, total)
If you wish to include NA too in the toal then you can use this:
var total = count([columnname])
@DataAnalyst13 -> Please hit the thumbs up & mark it as a solution if it helps you. Thank you.
divide(calculate(count(Table[column]), filter(Table, Table[flag] in {"Yes", "No"})) ,
calculate(count(Table[column]), filter(allselected(Table), Table[flag] in {"Yes", "No"})) )
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
118 | |
101 | |
71 | |
61 |