Forum Discussion

FoadTanbour's avatar
FoadTanbour
Regular Visitor
3 years ago

Filtering table with slicer selection

Hello All, I am trying to filter a table (or build a dynamic table or a summarized table) with multiple values from a slicer.  I have collected the slicer selections into a string like this "F", "M" and then in DAX added

filter(Grades,Grades[Gender] in {[List of Gender values]})
Of course because my measure is just a string concatenation of the slicer selections and not a table or list, it does not work 😞
Thank you
===================
Here's my code:
New Grades Table =
var GenderFilter = filter(Grades,Grades[Gender] in {[List of Gender values]})
return
CALCULATETABLE(Grades, GenderFilter)
 
and the list measure:
List of Gender values = var z =
        CONCATENATE(CONCATENATE("""",
        CONCATENATEX(VALUES('Grades'[Gender]),          'Grades'[Gender], """, """, 'Grades'[Gender],    ASC    )
        ), """")
            return z

2 Replies

  • hi FoadTanbour 

    The content of a post shall be dominated by sample data and expected result, instead others. 

    • FoadTanbour's avatar
      FoadTanbour
      Regular Visitor

      Hello FreemanZ  and thanks so much for your prompt response.

      Pls see here for pbix and data and notice that when you select student, it filters the grades table but not the the Grades Summary.

      Of course this example is a simplified version of what I am looking for, which is to be able to include the selected student id from a visual or slicer in the Summarize  command as a filter, however, if I collect the selected student id's and concatenate them, the filter "in" command does not accept them because they are a string and it is expecting a table.

       

      https://drive.google.com/drive/folders/16ara2LXEQaoposEGcIMS9VbNhlqj0eIN?usp=share_link

       

      Thanks so much