top of page

Buttons to highlight a selected measure!

Updated: Jul 31, 2021

Buttons may be my favorite visual in Power BI. I have been working with reports that utilize a selected measure pattern, such as a slicer to change the measures on charts from Sales to Revenue. In my recent challenge report I have a slicer to change all the charts on the page to one of four measures: Customers, Orders, Revenue, or Sales. I was using a Numerro template that had a 4 cards at the top with an icon for each. I thought it would be neat to shade those icons to show which measure was active, like this:

Here, I have selected "Customers" and the icon for Customers highlights in yellow. If I select "Orders" then its icon should highlight, etc.

This is the way I did this using buttons:


1) The icons are already in place as images, so I deleted them, and replaced the first one with a button (I will do the rest after we set up this first button). I set the image in the "Fill" section of the "Format Button". This works really well because to change out an icon I simply remove the icon from the fill section and pick a new one! The image is a file on my computer, not a link or base64 included image as well. All the other settings stay the same. I have turned off all the other "Format button" sections.

2) Next I created a measure that converts what the selected measure is from a text value to a number value. This is important for setting the conditional formatting for the fill color, as it needs to be a number. My selected measure is driven by a table where I have the four possible measures as text, so I just need to use SELECTEDVALUE() to find which one is currently in use, and give it a unique number. If there is no measure selected, I chose to return blank, but if I had a default measure I could have chosen to use that ones value too.

3) Back in the "Fill" section of the button, the fill color can changed with conditional formatting -- that's the little "Fx" button by the fill color. I made sure to pick a good default fill color before setting up the conditional formatting. That default color will be the fill color of the unselected measures. Then I click the "Fx" button and set up the conditional formatting for the selected measure.

I chose to format by rules, based on field "Selected Measure Formatting", and if the value is 1 (number, not percent!) then it will be the light yellow color I wanted. I click OK when I am done setting this up.

Here I know that Customers is value 1, so I set that to be the yellow highlight color. I don't do anything else. If it's any value other than 1, then the default color will be used instead.


4) Now that first button is set up, I will copy and paste it for the next one, Orders. For the new button I (1) change the image and then I (2) modify the fill color conditional formatting this time to look for the value to be 2. I do the same for the Revenue and Sales measures. And I am done!


Hope this helps you in your reports, or gives you other ideas of how to utilize buttons in your reports. Thank you for reading!

1,677 views0 comments

Recent Posts

See All
bottom of page