Open In App

Create a Toggle Button in Power BI

Improve
Improve
Like Article
Like
Save
Share
Report

The Toggle button is a control element that allows the user to switch between the different states like switching between the images, measurements, pages, and many more. This toggle button makes reports more interactive. The main advantage of the toggle button is it creates space in the report rather than using two images in the report we can keep it as one by switching using the toggle button. 

Understanding Toggle Button in PowerBi

For better understanding let us create a toggle button that switches between the sum and percentage of sales in a matrix. When the toggle button is off the matrix should show the sum of sales in the particular year, when the toggle is on the matrix should show the percentage of the grand totals of sales in the particular year.

Dataset Used

Let us consider the sales_table for PowerBi which contains sales information of products in INDIA by the customers in the year 2019,2020. The dataset for sales_table is here.

Steps to Create Toggle Button

First and foremost we need to create a toggle button. The Toggle button works with the help of bookmarks, to create a toggle button first we should create a bookmark.

Step 1: Go to view and select the Bookmark option.

STEP – 1

Step 2: You can see the Bookmarks panel opened then click on Add to add bookmarks naming

  1. Toggle_on 
  2. Toggle_off

STEP – 2

Step 3: Next insert a bookmark navigator by going to insert and clicking on Buttons, from Navigators in the drop-down opened select Bookmark Navigator

STEP – 3

Step 4: You can observe a bookmark created on our dashboard with Toggle_on and Toggle_off states as shown in the below image

TOGGLE_ON AND TOGGLE_OFF

Step 5: Now go to Bookmark Navigator again, select Toggle_on, and right-click and select Group. You can rename the Group but here we are not renaming it.

GROUP THE TOGGLE_ON

Step 6: Now go to the Formatting option of Bookmark and click on Bookmarks. From the drop-down of Bookmark you can see the Toggle_on group created above, so select the Group-1 option.

SELECT GROUP 1

Step 7: Now switch on the Allow deselection option(you can see this option below the bookmarks) and select Toggle_off from the drop-down of Launch on deselection.

ALLOW DESELECTION

Step 8: The primary setup for the toggle button is completed. Now go to the Bookmark panel and rename the Toggle_on with a dot by copying and pasting the Unicode character circle. This makes our toggle button look realistic.

RENAMING THE TOGGLE_ON

Step 9: You can observe the dot popping up on the toggle as below image.

IMAGE SEEN IN THE DASHBOARD

Step 10: We need to format the toggle button according to our needs. To do this first, you need to do is Go to the Bookmark panel and select Toggle_off. Point to be noted that the State should be in Default in the Format panel. Accustomed it as it appears like a toggle button. Below are the formatting options I have used according to my need. You can use your creativity.

FORMATTING THE TOGGLE_OFF

Step 11: Same as above do for Toggle_on also. To do this firstly, you need to do is Go to the Bookmark panel and select the dot. Now start formatting it. Point to be noted that the State should be in Selected in the Format panel. Accustomed it as it appears like a toggle button. Below are the formatting options we have used according to my need. You can use your creativity.

 

Step 12: Hurrey, you have to create a toggle button. You can check this by clicking on it by using ctrl+click

TOGGLE BUTTON

Step 13: Now we need to add this toggle button to our respective visuals. Here we have created two matrices one with the sum of sales and another with the percentage of the grand total.

MATRICES

Step 14: Now overlap two matrix visuals shown above on one other. We intend to show one image and hide another when the toggle is on and vice versa when the toggle is off

Step 15: Now go to view and click on the selection panel. It contains three options namely bookmark, the sum of sales, and the sum of sales in %. Try to hide one matrix and unhide another by keeping on the toggle button on as shown in the below image.

ADJUSTING THE TOGGLE BUTTON FOR OUR SUM OF SALES%

Step 16: Then go to the bookmark panel and update the toggle on by selecting the sum of sales and the sum of sales%(the update option can be seen by right-clicking on toggle_on) for better understanding see the below screenshot.

UPDATING THE TOGGLE BUTTON

Step 17: Repeat the above two steps in the reverse pattern of the hidden and unhidden state by keeping the toggle off. This time you need to update the Toggle off by selecting bookmark navigator, the sum of sales, and the sum of sales%(the update can be seen by right-clicking on toggle_off)

SELECTING AND UPDATING THE SUM OF SALES WITH THE TOGGLE BUTTON

Step 18: Finally the Toggle button is created which was switching between the two images.

TOGGLE SWITCHING BETWEEN THE MATRICES


Last Updated : 30 Mar, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads