Power BI has made a lot of recent improvements to button functionality over the last few updates. Among these changes, we can now dynamically set the text of a button! On top of that, we can dynamically set the Web URL that a button can navigate to, creating a nice way to drive traffic from your Power BI report to a web page. In this post, we are going to learn how to set up a button with dynamic text, a dynamic URL, and a dynamic tooltip since these methods go hand-in-hand.

I will start by creating a blank button and placing it on the canvas. I’m going to perform a couple formatting steps to make the button visually appealing, such as making the border round (30 px), setting a fill color for the default state, on hover state, and on press state. Finally, I will give the button some static text for now and make it white. At this point, my button looks as such:

Great, let’s now make our button text dynamic with the help of a measure. I’m going to create a measure called “Dynamic Button Text” and give it the following DAX:

Dynamic Button Text = 
   "Select a Video to Watch"

This code uses the HASONEVALUE function to determine if I am filtered down to a single video. If so, return the name of the video, else return a simple response such as “Select a Video to Watch.” To be clear, I only want to return the name of a video when a single video is selected with the intention of navigating to that video on the web.

Now we just need to edit the Button Text of the button by clicking on the three dots on the right side of the Button Text field and applying conditional formatting. This will open a menu asking which field or measure we want to use to drive the button text. I will select out new measure titled “Dynamic Button Text” and click OK.

Testing out our new button with dynamic text, we can already see some great results.

Setting up the Dynamic URL and Tooltip will follow almost the exact same steps. Let’s duplicate our previous measure and swap out the Title field for the Video URL field. The final DAX looks as such:

Dynamic Web URL = 
   HASONEVALUE(Videos[Video URL]),
   MAX(Videos[Video URL]),

Also note that I am returning BLANK() when there is more than one video selected, since I don’t want to navigate anywhere unless I am filtered down to a single video. To finalize, enable Action in the button settings and apply conditional formatting to the Web URL field to use our new measure. While you’re at it, set up the same conditional formatting for the Button Tooltip since it would be nice if the tooltip would tell us where we will be navigating.

And with that, we’re done! Take a look at the final result in the following gif. We successfully have a button that changes text, Web URL, and tooltip based on a selection. How cool is that?

Also, if you’re looking for top Power BI training for a fraction of the price, make sure to check out the BI Elite Training portal! There is a ton of great info available that you’re sure to enjoy.

Parker Stevens

Parker is the creator of the BI Elite YouTube channel, a community of over 15,000 students learning Power BI, DAX, and Power Query. He is currently a Microsoft Data Platform MVP for his work with Power BI and continues to provide elite Power Platform training courses to help data analysts, BI developers, and citizen dashboard creators reach their goals. Parker is committed to producing high-quality training content that is also extremely cost-effective, to ensure that the largest amount of users can benefit from the content.