Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello all!
I am struggling with what seems to be an easy task.
I have a table named "success" that looks like the one below. I have the Category and the Outcome, and I would like to calculate the Success Rate for each category, such that the numbers are as the ones indicated in the column "Success Rate". I tried different methods with Count and Filter but failed every time. Thank you!
Category Outcome Success Rate
A | TRUE | 100% |
B | FALSE | 0% |
D | TRUE | 100% |
A | TRUE | 100% |
B | FALSE | 50% |
C | FALSE | 50% |
E | FALSE | 50% |
A | TRUE | 100% |
E | FALSE | 50% |
C | TRUE | 50% |
Solved! Go to Solution.
@Anonymous - Here is the column you asked for. PBIX is attached below sig. Table (19)
Success Rate =
VAR __True = COUNTROWS(FILTER('Table (19)',[Category]=EARLIER([Category]) && [Outcome]))
VAR __False = COUNTROWS(FILTER('Table (19)',[Category]=EARLIER([Category]) && NOT([Outcome])))
VAR __Result = DIVIDE(__True,__True+__False,0)
RETURN
IF(ISBLANK(__Result),0,__Result)
@Anonymous - Here is the column you asked for. PBIX is attached below sig. Table (19)
Success Rate =
VAR __True = COUNTROWS(FILTER('Table (19)',[Category]=EARLIER([Category]) && [Outcome]))
VAR __False = COUNTROWS(FILTER('Table (19)',[Category]=EARLIER([Category]) && NOT([Outcome])))
VAR __Result = DIVIDE(__True,__True+__False,0)
RETURN
IF(ISBLANK(__Result),0,__Result)
@Anonymous ,
A new measure like
Calculate(Divide(calculate(Count(Table[Outcome]),[Outcome] ="TRUE") ,Count(Table[Outcome])), allexcept(Table,Table[Category]))
Or a new column
column =
var _cnt =countx(filter(Table , [Category] =earlier([Category])),[Category])
var _cntTR =countx(filter(Table , [Category] =earlier([Category]) && [Outcome] ="TRUE"),[Category])
return
divide( _cntTR,_cnt)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |