Categories
Data

Who hates Power BI URL Parameters?

I love ’em, me, until I need to extract a custom URL – especially if it’s to this, this, this, and this – to share with others. With a bit of DAX and button trickery, however, there’s a way to add a button to a page so once values are selected in a slicer, the button is displayed – allowing us to save the URL to that filtered set… 🥳

Three simple steps to achieve this:

1. Add a measure concatenating the values in a slicer to your DAX query:

GenerateLink =
  VAR ConCat =
     CALCULATE (
        CONCATENATEX (
           VALUES ('Table'[RowID]),
           'Table'[RowID], ","
        )
     )
  VAR Link = 
    "https://app.powerbi.com/groups/me/reports/[YourReportID]?chromeless=1&filter=Table%2FRowID%20in%20("&Concat&")"
  RETURN 
    Link

2. Add measures to make the button’s text and icon black or red if any values are selected, and transparent if none are:

MakeTransparent =
   IF(ISFILTERED(Table[RowID]),"Black","#FFFFFF00")
MakeRed =
   IF(ISFILTERED(Table[RowID]),"Red","#FFFFFF00")

3. Finally, add a button, specifying a ‘Rule’ to use MakeTransparent and MakeRed values for the icon and text colour default/hover states, and the ‘Action’ to go to the webpage based on the ‘GenerateLink’ measure.

Leave a Reply

Your email address will not be published. Required fields are marked *