Forum Discussion

aspitalnick's avatar
aspitalnick
Frequent Visitor
1 year ago

Help with counting and filtering

I have a table called 'CreateAReport (2)' with a field called [LastName FirstName]. I was able to get a count of how many times a person shows up in a table with the measure below:

Years_count = CALCULATE(COUNTROWS('CreateAReport (2)'))
I created a table and pulled in that measure and the LastName FirstName field
What I am trying to do now is create a filter that will effect all visuals on a page where I can select Years_count is greater than 2 (or 3 or 4 or 9) and it will filter my dataset. Any advice on how to achieve this?
 

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi aspitalnick ,

     

    Please refer to the following steps.

    The test data is as follows.

     

    Create a table including the count measure and the 'LastName FirstName' field.

    Table = DISTINCT(SELECTCOLUMNS('CreateAReport (2)',"LastName FirstName",[LastName FirstName],"Years_count",[Years_count]))

     

    Use the Years_count field to create a slicer.

     

    Create a measure to be used as a visual level filter.

    Measure = IF([Years_count] IN VALUES('Table'[Years_count]),1,0)

     

    Place this measure in the visual's filter and set it to is 1.

    In this way, the Years_count slicer can filter other visuals.

     

    Please see the attached pbix for reference.

     

    Best Regards,
    Dengliang Li

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