To implement this recipe, perform the following steps:
- Create the following measures:
Red Error =
VAR __Color = MAX('R01_Table'[Color])
RETURN
IF(
__Color = "Red",
ERROR("Error: Red encountered"),
__Color
)
Red IsError =
VAR __Color = MAX('R01_Table'[Color])
RETURN
IF(
ISERROR(
IF(
__Color = "Red",
ERROR(""),
FALSE
)
),
"Error: Red encountered",
__Color
)
Red IfError =
VAR __Color = MAX('R01_Table'[Color])
RETURN
IFERROR(
IF(
__Color = "Red",
ERROR(""),
__Color
),
"Error: Red encountered"
)
- On a Report page, create a Slicer visualization and place the Color column from table R01_Table into the Field area of the visualization.
- On the same Report page, create a Table visualization and place the Color column from table R01_Table and the measure Red Error into the Values area of the visualization.
- On the same Report page, create a second Table visualization and place the Color column from table R01_Table and the measure Red IsError into the Values area of the visualization.
- On the same Report page, create a third Table visualization and place the Color column from table R01_Table and the measure Red IfError into the Values area of the visualization.
Note that if the color Red is selected in the slicer, then the first Table visualization with the measure Red Error shows an error saying that the visual cannot be displayed. Clicking on the See details link provides an error description that includes the error message Error: Red encountered. Conversely, the other two table visualizations with the measures Red IsError and Red IfError continue to display the visualizations and include the error message Error: Red encountered as the value for the measures Red IsError and Red IfError respectively.