Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
askme1217
Frequent Visitor

Help : DAX measure

i am creating a measure to pass filters via url.  For single filters its working but i need to make it more dynmaic since my report has over 10 slicers. so here is the url. and slicers  like  slicer1,slicer2, slicer3,slicer4,slicer5, slicer6,slicer7,slicer8, slicer9,slicer10

slicers can be selected as, All, single value, or multiple values.  i need to construct below url dynamically based on above slicer selections. when slicer is not filtered (or All) i dont want to pass any filter but when single or multiple, i want to pass

like ex: if slicer1 and slicer2 are selected and rest of them are not filtered, i want

url =   https://app.powerbi.com/xxxxxxxx?experience=power-bi + slicer1+slicer2 

so basically, only when a slicer is filtered, pass it in url otherwise no. SInce i have 10 slicers, how can i write it dynamically.?

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @askme1217 ,

 

For this you need to use the syntax of the table/column and then using a sintax with a in statement. and for each table add an AND.

 

So you would get something similar to: 

url =   https://app.powerbi.com/xxxxxxxx?experience=power-bi ?filter=Table1/Column1 in ('data1', 'data2') and Table2/Column1 in ('data3', 'data4')

You can check the details on this link below:
https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-url-filters#filter-on-multiple-...
To get the values for the DAX syntax you would need use a concatanex of the VALUES of your field values that are selected on the slicer.

 

So that would be something similar to:

filter Values =
VAR slicer1 =
    CONCATENATEX (
        ADDCOLUMNS (
            VALUES ( 'Table1'[Column1] ),
            "FilterColumn",
                "'" & 'Table1'[Column1] & "'"
        ),
        [FilterColumn],
        ","
    )
VAR slicer2 =
    CONCATENATEX (
        ADDCOLUMNS (
            VALUES ( 'Table2'[Column1] ),
            "FilterColumn",
                "'" & 'Table2'[Column1] & "'"
        ),
        [FilterColumn],
        ","
    )
RETURN
    "https://app.powerbi.com/xxxxxxxx?experience=power-bi & ?filter= Table1/Column1 in (" & slicer1 & ") and Table2/Column2 in (" & slicer2 & ")"

Be carefull that this type of measure can return a error in text lenght. you may also need to adjust the full detail of the URL and the way the slicers works in the concatanex

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @askme1217 ,

 

For this you need to use the syntax of the table/column and then using a sintax with a in statement. and for each table add an AND.

 

So you would get something similar to: 

url =   https://app.powerbi.com/xxxxxxxx?experience=power-bi ?filter=Table1/Column1 in ('data1', 'data2') and Table2/Column1 in ('data3', 'data4')

You can check the details on this link below:
https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-url-filters#filter-on-multiple-...
To get the values for the DAX syntax you would need use a concatanex of the VALUES of your field values that are selected on the slicer.

 

So that would be something similar to:

filter Values =
VAR slicer1 =
    CONCATENATEX (
        ADDCOLUMNS (
            VALUES ( 'Table1'[Column1] ),
            "FilterColumn",
                "'" & 'Table1'[Column1] & "'"
        ),
        [FilterColumn],
        ","
    )
VAR slicer2 =
    CONCATENATEX (
        ADDCOLUMNS (
            VALUES ( 'Table2'[Column1] ),
            "FilterColumn",
                "'" & 'Table2'[Column1] & "'"
        ),
        [FilterColumn],
        ","
    )
RETURN
    "https://app.powerbi.com/xxxxxxxx?experience=power-bi & ?filter= Table1/Column1 in (" & slicer1 & ") and Table2/Column2 in (" & slicer2 & ")"

Be carefull that this type of measure can return a error in text lenght. you may also need to adjust the full detail of the URL and the way the slicers works in the concatanex

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors