How to Add a Toggle Feature to Your Power BI Report

Introduction

Have you ever wanted to add a toggle feature to your Power BI Desktop Report, but don’t know how? Well the good news – it is easy to do, and even better news I will show you how to 🙂 

A quick background – A toggle switch was made so users could see if the change was made successfully within the due date and the non-policy toggle was created to show if the change was successful, but not within the due date.

In my blog, I will show you how to load an image, how to create a bookmark and hide objects, and how to add an action to the buttons.

Terms

There are a few key terms you need to know before we get started:

Selection Pane – gives you the option to show or hide objects.

Bookmark – is like a screenshot of your current report. Creating a bookmark, gives you the ability to view it later on.

Select Images

Let’s focus our attention to the two visualizations that we want to toggle. We will want our visualizations to look like below.

On the first visualization, we want the per policy text and the toggle button turned on.

On the second visualization, we want the non-policy text and the toggle button turned off.

Find toggle images

1. You will need to find a toggle image on a search engine of your choice. Make sure you have two images – on and off.   For example, below are the two images I used. 

2.To save your images, go to your Power BI Images subfolder.

Upload your Toggle On Button

3. To upload the toggle button, go to the Insert tab.

4. In the Elements Group, select the Image Icon button.

5. A dialog box will appear to allow you to find the folder which holds your image. Go to Power BI – Images. Select it and then press the open button.

6. Your image appears, but most likely will need resizing.

7. To add verbiage, select the Text Box button.

8. A text box will appear. Add your verbiage and resize the text box to your liking.

9. Your image should look like below. The toggle button is on along with the Per Policy text.

Upload your Toggle Off Button

10. To upload the toggle button, go to Insert tab.

11. In the Elements Group, select the Image button.

12. A dialog box will appear to allow you to find the folder which holds your image. Go to Power BI – Images. Select it and then press the open button.

13. Again, your image will need resizing.

14. Go to the Insert tab, and select the Text Box button.

15. A text box will appear. Add your verbiage and resize the text box to your liking.

Create Bookmarks and Hide Objects

Toggle On

16. Select the View tab.

17. Select Bookmarks and Selection buttons.

18. To your right, you will see the selection and bookmark pane. The bookmark pane will be used to add two screenshots. One for the “toggle on” view and the other for the “toggle off” view.

19. In the Selection Pane, you can rename, show or hide your objects.

20.  To rename, double click the relevant object and a white box appears. I recommend giving objects a relevant name so they can be easily recognized when hiding or unhiding your objects.

21. Hide the non-policy and toggle button off objects by selecting the eye icon.

*For this visualization, I also hid the visibility of “Overall Change Success% Non-Policy” and “Unsuccessful Changes non-policy” objects.

22. After you have finished the selection, we can now move on to the Bookmarks Pane.

23. In the Bookmarks pane, click the Add button, and then rename the bookmark to Per Policy

Toggle Off

24. In the selection pane, hide the “Per Policy Text” and “Toggle Button On” objects.

25. Show the objects Non-Policy and Toggle Button off

26. Select the Add button

27. Name your new bookmark “Non-Policy”.

Add an Action

Toggle On

28. Select the Per Policy bookmark

29. Select the “Toggle Button” on image.

30. The format button pane will appear

31. Go to the Action and expand the section.

32. In the Action section, go to Type and verify bookmark is selected. 

33. In the Action section, go to Bookmark and select Non-Policy. When the toggle button is on, and your user clicks it the button will need to go to the Non-Policy bookmark. 

Toggle Off

34. Go back to the Bookmarks Pane, and select the Bookmark “Non-Policy” 

35. Select the toggle off button.

36. The Toggle Off Button’s Format Pane appears. 

37. Go to the Action Section and Maximize the section

38. In the Action section, go to Type and verify bookmark is selected. 

39. In the Action section, go to Bookmark and select Policy. When the toggle button is off, and your user clicks it the button will need to go to the Policy bookmark. 

Conclusion

We selected an image to create our toggle button, then we used the selection pane to show/hide relevant objects. Next, we created bookmarks to take a screenshot of our pages, and last we setup actions to have the toggle switch between pages when selected. 

Congratulations! You now have a toggle button that you can switch on or off! Have fun using your new skills!

Data Diva

Priscilla Camp is a Business Intelligence and Analytics Specialist at the University of Central Florida. She has 10 years of experience in the field of IT working as a Business Intelligence Analyst. Priscilla started her career working for a startup small business in 2010 and several years later moved over to the Higher Education Industry where she currently resides. Priscilla's focus is T-SQL, Data Warehousing, MS Power BI, and B.I. Strategy.