Forum Discussion

ElioXh's avatar
ElioXh
Regular Visitor
2 years ago

DAX - Filter All Columns from a Table Based on What-If Parameter

I have a table named "RunData" with dozens of columns, which I'd like to filter based on the value in the "RunNum" column based on a what-if parameter slider slicer. The result needs to be a table because are multiple rows that match the parameter, and I'd like the data from all the columns in the original table.

So I'd like to dynamically extract a subset of rows from my original table when I change the slider.

 

Creating a measure 

 

Measure = SELECTEDVALUE('RunData'[RunNum]) = 4

 

 and then a table based on that measure defined as 

 

FilteredTable = Filter('RunData',[Measure])

 

 works exactly as intended.

 

But updating the measure to not have the filter value hard coded (i.e. 4) but rather be the output of the what-if parameter breaks the functionality.

 

Following option all result in an empty FilteredTable:

Measure = SELECTEDVALUE('RunData'[RunNum]) = SELECTEDVALUE(RunFilter[RunFilter])
Measure = SELECTEDVALUE('RunData'[RunNum]) = RunFilter[RunFilterValue]

Thank you for your help

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ElioXh ,

     

    According to your description, I understand that you want to filter the table by measure with parameter. Unfortunately, New table Functions does not dynamically change as the measure changes. However, you can create a new table and use What-If Parameter to filter the data in the table.

     

    You can follow these steps:

    1.Add a parameter

    2.Add a measure

    Measure =
    
    IF (
    
        SELECTEDVALUE ( RunData[RunNum] ) = [Parameter Value],
    
        'Parameter'[Parameter Value],
    
        BLANK ()
    
    )
    
    

     

    Final output:

     

     

     

    How to Get Your Question Answered Quickly - Microsoft Fabric Community

    If it does not help, please provide more details with your desired out put and pbix file without privacy information.

     

    Best Regards,

    Yifan Wang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • ElioXh's avatar
      ElioXh
      Regular Visitor

      Hi Yifan,

       

      Thanks for your help, a sample pbix showcasing the issue can be dowloaded at the following link.

      DynamicFilter.pbix 

       

      Applying the parameter to a single column works exactly as intended, and can be driven by the parameter slider, but the issue for my end use-case is I have over 300 columns in my table, and defining measures for each column is not viable. Which is why I want to create a subset table of my original table, containing only the filtered rows of interest.

       

      If I define a filtered table as below, this works exactly as desired:

      FilteredTable = FILTER(RunData,RunData[RunNum]=4)

       

      But if I try and link the filter to use the parameter, that yields a blank table.

      FilteredTable = FILTER(RunData,RunData[RunNum]=SELECTEDVALUE(Parameter[Parameter]))

       

      Is there a way to create the subset table in a way that can be updated based on a parameter?