Create a Toggle Button in Power BI
Last Updated :
30 Mar, 2023
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
- Toggle_on
- 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
Similar Reads
Power BI - Create a Table
Tables are a way to represent data in the form of rows and columns. By default, the Power BI desktop creates a table itself, whenever data is dragged under the visualizations section. But, here will learn how to create the table manually, if not created by Power BI, we will also look at some aggrega
2 min read
Power BI - How to Create a Map?
A map only locates the location as a data point, whether it's a continent, country, state, city, etc. Maps can also be plotted with the help of latitude and longitude. Maps can be useful, to know the current running business over different geographical locations. For example, if geeks for geeks want
3 min read
Creating a Rolling Calendar in Power BI
Rolling calendars have become a vital tool in data analysis and visualization for monitoring and evaluating changes across time. By comparing recent data to past data dynamically and interactively, they give users the ability to spot trends, anomalies, and potential improvement areas. Users of the r
5 min read
Power BI - Tools and Functionalities
Power BI is a Data Visualization and Business Intelligence tool by Microsoft that converts data from different data sources to create various business intelligence reports. It provides interactive visualizations using which end users can create reports and interactive dashboards by themselves. It is
5 min read
Power BI - How to Create a Waterfall Chart?
A waterfall chart shows a running value as quantities are added or subtracted. Itâs helpful to visualize how an underlying value is influenced by a series of positive and negative changes. The columns are usually encoded using color so that you can quickly identify increments and decrements. In a wa
2 min read
Power BI - Create Slicer Chart
Power BI Slicers are the interactive filters used to format and analyze the parts of the data more effectively. They are basically filters for visuals. A slicer chart helps in sorting or slicing or filtering some unwanted stuff and viewing only the required important information in the visual pane.
6 min read
Power BI - How to create custom column?
In Power BI, irrespective of the data source we are importing data from, we are provided multiple options to modify it. One of the options available in Power BI is to create a custom column, i.e., using the columns present in our data by default, we can create custom columns and use that in our visu
4 min read
Power BI - How to create a Report in Workspace?
Power BI provides an auto-create report option, in the Power BI online service. One can create reports, on a workspace, as same as that in the Power BI Desktop. In this article, we will learn about how to create a report in a workspace. Creating a Report in Workspace - Power BI We have a workspace n
2 min read
Power BI - How to Create a Dashboard?
Dashboards are static, in nature, and are used to just view the final reports. Dashboards are only available, in Power BI online service, and not in the Desktop mode. In this article, we will learn how to create a dashboard, in a workspace. Creating a Dashboard In a Workspace in Power BI We have a w
2 min read
Angular Material Button Toggle
Angular Material is a UI component library that is developed by Google so that Angular developers can develop modern applications in a structured and responsive way. By making use of this library, we can greatly increase the user experience of an end-user thereby gaining popularity for our applicati
4 min read