Forum Discussion
Calculate Percentage value based on Slicer Selection
- 8 years ago
Assuming you have the criteria in a table called Criteria (I have called them "A"-"E") that you use for the slicer, and assuming the jobs are ina table called Jobs with criteria Columns containing boolean values (TRUE or FALSE) named A through E, the below should do it. The Criteria table can have no relationship with the Jobs table, and if you have other slicers involved it could require changes to the formula.
Percentage = COUNTROWS(FILTER(Jobs, IF(CONTAINS(Criteria,Criteria[Criteria],"A"), Jobs[A], TRUE) && IF(CONTAINS(Criteria,Criteria[Criteria],"B"), Jobs[B], TRUE) && IF(CONTAINS(Criteria,Criteria[Criteria],"C"), Jobs[C], TRUE) && IF(CONTAINS(Criteria,Criteria[Criteria],"D"), Jobs[D], TRUE) && IF(CONTAINS(Criteria,Criteria[Criteria],"E"), Jobs[E], TRUE)))/COUNTROWS(ALL(Jobs))
I have them as columns in the Jobs Table as "Yes"/"No" Values
Job Number | Criteria 1| Critera 1...
- BILASolution8 years ago
Solution Specialist
This way???
Total Jobs = CALCULATE(DISTINCTCOUNT(Job[Job Number]);ALL(Job))
Total Criteria = CALCULATE(DISTINCTCOUNT(Job[Job Number]);Job[Value] = "Yes")
Precentage = DIVIDE([Total Criteria];[Total Jobs])
Best Regards
BILAsolution
- bhmiller898 years ago
Helper V
not quite, I have columns written for each. Example: the column is titled "Criteria 1" and the values are either "Yes" or "No" based on an If/Then statement. I did it this way for each Criteria.
Job Number| Criteria 1| Criteria 2|Criteria 3| .......
_____________________________________________________
XXX-XXX| "Yes"| "No"| "Yes"......
- erik_tarnvik8 years ago
Solution Specialist
If you have them as “Yes”/“No”, just change Jobs[A] to Jobs[A] = “Yes” and so on for each criteria in the measure I proposed.