Forum Discussion
Cannot get toggle button color "ON" setting to change
I created a toggle with bookmarks. When I have the toggle "ON" (black dot under "NAME) the fill color option is showing the fill color when the toggle is "OFF". If I change the fill color, it changes the color of the "OFF" state, not the "ON" state as desired. Can someone help me figure out why I can't find the blue setting so I can change blue to another color for the "ON" state bookmarked?
- Anonymous1 year ago
I figured it out. I did not change "apply settings to" button "selected" as I should have. When I choose that, I now can see my blue fill, which I can now change to another color.
6 Replies
- danextian
Super User
Hi Anonymous
Conditional formatting isn't directly controlled by bookmarks but by the returned value of a DAX expression. If you want to use conditional formatting to change the color of a shape or text, use a slicer to control the value of a DAX expression and then use bookmarks to control the state of the slicer. If you dont want a slicer, you can use two different visuals that changes visibility with bookmarks.
- AnonymousNot applicable
It looks like my question wasn't posed clearly enough as none of these solutions address my issue. I know how to create a toggle and I formatted it using the format menu (no special dax at all). I originally saved the boookmark navigator as "BLUE" for on and "GRAY" for the off state. However, the only fill format for the navigator that works is the "OFF" state, even when I have chosen the "ON" state of the bookmark. I simply want to change my choice of color for "ON" from blue (my original format choice) to a darker green. But no matter what I do I cannot get it to work.
- AnonymousNot applicable
I figured it out. I did not change "apply settings to" button "selected" as I should have. When I choose that, I now can see my blue fill, which I can now change to another color.
- pankajnamekar25
Super User
Hello Anonymous
Explore the video
How to Create Toggle Button in Power BI Using Bookmarks and Images | Step-by-Step Tutorial #powerbi
- alish_b
Super User
Hey Anonymous ,
Please follow the video tutorial provided by pankajnamekar25 and you could use the file provided by danextian as a reference.
Let me give you some code to generate those toggle buttons (Copy them to a notepad and save them with .svg extension):
Toggle Off Button:<svg width="60" height="30" viewBox="0 0 60 30" xmlns="http://www.w3.org/2000/svg"> <!-- Toggle slider (left position for Summary) --> <circle cx="15" cy="15" r="12" fill="#ffffff" stroke="#cccccc" stroke-width="1"/> <!-- Subtle shadow for depth --> <defs> <filter id="shadow"> <feDropShadow dx="0" dy="1" stdDeviation="1" flood-color="#000000" flood-opacity="0.15"/> </filter> </defs> <circle cx="15" cy="15" r="12" fill="#ffffff" stroke="#cccccc" stroke-width="1" filter="url(#shadow)"/> </svg>
Toggle On Button:<svg width="60" height="30" viewBox="0 0 60 30" xmlns="http://www.w3.org/2000/svg"> <!-- Toggle slider (right position for Detailed) --> <circle cx="45" cy="15" r="12" fill="#ffffff" stroke="#cccccc" stroke-width="1"/> <!-- Subtle shadow for depth --> <defs> <filter id="shadow"> <feDropShadow dx="0" dy="1" stdDeviation="1" flood-color="#000000" flood-opacity="0.15"/> </filter> </defs> <circle cx="45" cy="15" r="12" fill="#ffffff" stroke="#cccccc" stroke-width="1" filter="url(#shadow)"/> </svg>Once you have saved them as .svg files, add two blank (Insert>Buttons>Blank) buttons in the report and add the respective svg images under Button>Style>Fill and the Browse (below Color) section and use the Color to change the toggle button background color as you wish (the circle will be white though). Also, you can turn off Icon and Border under the Style section.
Hope it helps!
- v-saisrao-msft
Community Support
Hi Anonymous,
Have you had a chance to review the solution we shared by alish_b danextian pankajnamekar25 ? If the issue persists, feel free to reply so we can help further.
Thank you.