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 have a measure that calculates the % of completed tasks that have achieved SLA, When i use my Slicer to choose "CAT 2 Achieved SLA" it shows correct value, but when i select "CAT 2 Missed SLA" the slicer shows an Incorrect value. I would like the value to show as 0% when anything other than "CAT 2 Achieved SLA" is selected.
Thanks in advance!
CAT 2 SLA Achieved % =
var CAT2A=
CALCULATE(
COUNT('Master AllCSA-ExternalOPEX'[Is Job within SLA]),
'Master AllCSA-ExternalOPEX'[Is Job within SLA]="CAT 2 Achieved SLA"
)
return
var CAT2AT=
CALCULATE(
COUNT('Master AllCSA-ExternalOPEX'[CATEGORY]),
'Master AllCSA-ExternalOPEX'[CATEGORY]="CAT 2",
'Master AllCSA-ExternalOPEX'[Status]="Completed"
)
return
var CAT2AP=
CALCULATE(
(CAT2A/CAT2AT)
)
return
IF(
ISBLANK(
CAT2AP),
"0%",
IF(
ISERROR(
CAT2AP),
"0%",
CAT2AP)
)
@Michael117 , where is code for CAT 2 Missed SLA.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
May be you leave condition on selected value - selectedvalue(Slicer[slicer])
CAT 2 SLA Achieved % =
var CAT2A=
CALCULATE(
COUNT('Master AllCSA-ExternalOPEX'[Is Job within SLA]),
'Master AllCSA-ExternalOPEX'[Is Job within SLA]=selectedvalue(Slicer[slicer])
)
return
var CAT2AT=
CALCULATE(
COUNT('Master AllCSA-ExternalOPEX'[CATEGORY]),
'Master AllCSA-ExternalOPEX'[CATEGORY]="CAT 2",
'Master AllCSA-ExternalOPEX'[Status]="Completed"
)
return
var CAT2AP=
CALCULATE(
(CAT2A/CAT2AT)
)
return
IF(
ISERROR(
CAT2AP),
"0%",
CAT2AP)
Hello @amitchandak ,
I just tried to add Selectedvalue to the formula and received this error;
"A function 'SELECTEDVALUE' has been used in a True/False expression that is used as a table filter expression. This is not allowed."
I'm still working on setting up the test pbix for you. Thanks
@Michael117 , Try in the filter
CAT 2 SLA Achieved % =
var CAT2A=
CALCULATE(
COUNT('Master AllCSA-ExternalOPEX'[Is Job within SLA]),
filter('Master AllCSA-ExternalOPEX','Master AllCSA-ExternalOPEX'[Is Job within SLA]=selectedvalue(Slicer[slicer]))
)
return
var CAT2AT=
CALCULATE(
COUNT('Master AllCSA-ExternalOPEX'[CATEGORY]),
'Master AllCSA-ExternalOPEX'[CATEGORY]="CAT 2",
'Master AllCSA-ExternalOPEX'[Status]="Completed"
)
return
var CAT2AP=
CALCULATE(
(CAT2A/CAT2AT)
)
return
IF(
ISERROR(
CAT2AP),
"0%",
CAT2AP)
Hi @amitchandak ,
The filter with selected value didn't achieve the desired outcome. I have added a link to the PBIX file in OP and below;
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 |
---|---|
114 | |
99 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |