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 used your calculations:
Test%Total = COUNTROWS(FILTER(ActiveProjects, IF(CONTAINS(ActiveProjects, 'dpmgr vwJMWebJobSummary'[IsSOWHrs>300], "Yes"), ActiveProjects[Job Number], TRUE())&& IF(CONTAINS(ActiveProjects, 'dpmgr vwJMWebJobSummary'[IsLengthDays>180], "Yes"), ActiveProjects[Job Number], TRUE()) && IF(CONTAINS(ActiveProjects, 'dpmgr vwJMWebJobSummary'[IsActualEHR < $160], "Yes"), ActiveProjects[Job Number], TRUE()) && IF(CONTAINS(ActiveProjects, ActiveProjects[Is%HrsCompletion>75%], "Yes"), ActiveProjects[Job Number], TRUE()) && IF(CONTAINS(ActiveProjects, ActiveProjects[IsLastJR>60], "Yes"), ActiveProjects[Job Number], TRUE())))/COUNTROWS(ALL(ActiveProjects))
but I'm getting an error "Calculation error in measure.... Cannot convert value "2014-DLL-J27 (which is a job number), of type Text to type True/False"