Forum Discussion
NSBS
3 years agoHelper I
Counting Rows with Conditions in Measure
Hi PowerBI Community, Need some help in creating a DAX measure code for below case. Considering below attempt # and its status for each person, and the Overall Status will be consided as "Pass...
- 3 years ago
Hi NSBS ,
Please try:
Count Passed = var _a = ADDCOLUMNS(ALL('Table'),"Overall", IF("Passed" in SELECTCOLUMNS(FILTER('Table',[Name]=EARLIER('Table'[Name])&&[Attempt]<=3),"Attempt status",[Attempt Status]), "Passed","Failed")) return CALCULATE(DISTINCTCOUNT('Table'[Name]),FILTER(_a,[Overall]="Passed"))Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jianboli-msft
3 years agoCommunity Support
Hi NSBS ,
Please try:
Count Passed =
var _a = ADDCOLUMNS(ALL('Table'),"Overall", IF("Passed" in SELECTCOLUMNS(FILTER('Table',[Name]=EARLIER('Table'[Name])&&[Attempt]<=3),"Attempt status",[Attempt Status]),
"Passed","Failed"))
return CALCULATE(DISTINCTCOUNT('Table'[Name]),FILTER(_a,[Overall]="Passed"))
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.