Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi,
I'd like to add a line and textbox to my chart that only appears when a certain filter is selected and isn't visible on other filtered views. This is for a multi-platform line chart showing awareness, and I want to add text boxes explaining specific spikes in the data that's only relevant to the platform being displayed e.g. viral posts on Twitter that disappear when switching to the Facebook filter. Below is what I'm hoping to end up with:
Is there a way I can hide lines/text boxes when a certain filter is or isn't applied?
Thanks!
Solved! Go to Solution.
Hi @ENB15 ,
To achieve this, Power BI currently doesn't support conditional visibility of visual elements (like lines or text boxes) directly based on slicer selections or filters in a straightforward manner. However, you can utilize a workaround that involves creating measures that return values conditionally based on your filter selection and then using these measures to drive the visibility of annotations in your chart. Here's a concise action plan:
1.Create a Measure for Conditional Display: You'll need to create a DAX measure that evaluates to different values based on the filter applied. For instance, if you want a text box to appear for Twitter data, the measure could return 1 when the Twitter filter is applied and 0 otherwise.
DisplayAnnotation = IF(SELECTEDVALUE(YourTable[Platform]) = "Twitter", 1, 0)
2.Use the Measure to Control Annotation Visibility: While you cannot directly hide/show text boxes, you can create a card visual next to your line chart that uses the measure. You can then use conditional formatting to make the card appear blank (by setting font and background to the same color) when the measure returns 0, and display your annotation when it returns.
3.Dynamic Line for Specific Data Points: For highlighting specific data points or spikes, consider using a combination of scatter charts or conditional formatting within your line chart to dynamically highlight these points based on the same measure logic.
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @ENB15 ,
To achieve this, Power BI currently doesn't support conditional visibility of visual elements (like lines or text boxes) directly based on slicer selections or filters in a straightforward manner. However, you can utilize a workaround that involves creating measures that return values conditionally based on your filter selection and then using these measures to drive the visibility of annotations in your chart. Here's a concise action plan:
1.Create a Measure for Conditional Display: You'll need to create a DAX measure that evaluates to different values based on the filter applied. For instance, if you want a text box to appear for Twitter data, the measure could return 1 when the Twitter filter is applied and 0 otherwise.
DisplayAnnotation = IF(SELECTEDVALUE(YourTable[Platform]) = "Twitter", 1, 0)
2.Use the Measure to Control Annotation Visibility: While you cannot directly hide/show text boxes, you can create a card visual next to your line chart that uses the measure. You can then use conditional formatting to make the card appear blank (by setting font and background to the same color) when the measure returns 0, and display your annotation when it returns.
3.Dynamic Line for Specific Data Points: For highlighting specific data points or spikes, consider using a combination of scatter charts or conditional formatting within your line chart to dynamically highlight these points based on the same measure logic.
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.