Power BI offers various features to improve visualization, and in this article we will look at creating a sort button for your charts.
Step 1: Create Your Chart
First of all create the chart you want to sort. In my example, it will be a bar graph of the cost of 20g of protein for different sources:
Step 2: Add Buttons
Navigate to Insert → Buttons → Blank to create buttons. Designate two buttons — one for ascending and one for descending sorting. In this example, I'll use buttons for "Most Expensive" and "Cheapest" products.
Customize button text via Format → Button → Style.
Step 3: Set Up Bookmarks
Navigate to the View tab → Bookmarks.
In the Bookmarks pane click on the "Add" button to create a new bookmark. Name the first bookmark; for example, "Most Expensive.”
With the "Most Expensive" bookmark selected, go back to your visualization. Arrange the data in descending order, reflecting the sorting you want for this bookmark.
Once your visualization is sorted, return to the Bookmarks pane. Click on the three dots (...) next to the bookmark you just created ("Most Expensive") and select "Update." This action saves the bookmark with the current state of your visualization.
Repeat the process to create a second bookmark.
Step 4: Link Buttons to Bookmarks
Click on each button, assign actions via Action → Type (Bookmark) → Bookmark (choose the relevant bookmark, e.g., "Most Expensive" for the first button). Repeat for the second button.
Voila! Your buttons are now configured to sort your visualization. For a live example, you can explore my visualization here.