Forum Discussion

Sarah_Maes's avatar
Sarah_Maes
Frequent Visitor
2 years ago

Long Term Solution: Ignoring Page-Level Filters with ISFILTERED

Hi all,

Thank you for reading my question.

I’ve created a slicer panel that contains several slicers. Because this slicer panel can be expanded or minimized, when minimized I want to let users know an exact number of filters that has been applied.

Problem 1:  A page-level filter also uses this column to remove some data from the page. This results in ISFILTERED returning true regardless of whether or not the slicer for tableX[Business Line] has been applied (see screenshot).

Problem 2: Since a couple of my slicers (fluo on the picture) originate in the same table, they filter each other. For example: 1 employee has only 1 Employer. When I filter on the slicer employee, I only want to see the number one ‘1’ listed. If I filter on employer and employee I want to see the number ‘2’ listed. I managed to get around this problem in my dax, but when the employer is filtered again in as a page-level filter (ref. problem 1), it will list number ‘2’ when only an employee is filtered in the slicer.

 

I am aiming for future-proof reporting:

  • I don’t want to create a duplicate column since my data model is already extensive.
  • I don’t want to with ‘COUNTROWS ( ALLSELECTED ( Table[Column] ) ) < 'X’ because my dim_table is dynamic and not static. Eg. It's possible that there is a new Business Line next year.

Is there a way to go around this problem?

Thank you a lot!
If you solve this, I give you a lifetime of good karma.

Sarah 🙂 


3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Sarah_Maes ,

    You mentioned that page-level filters affect the column you are using, which would cause this to return true even if no slicers are applied. To resolve this issue, consider using this function ALLSELECTED. It allows you to ignore page-level filters while still taking into account slicer selections.

    For a more dynamic approach, consider creating a measure leveraging the function to check the slicer selection and count it accordingly. This approach requires a measure for each slicer but avoids the need for static references or duplicate columns.

    EmployeeFilterCount = IF(ISBLANK(SELECTEDVALUE(tableX[Employee])), 0, 1)
    EmployerFilterCount = IF(ISBLANK(SELECTEDVALUE(tableX[Employer])), 0, 1)
    TotalFiltersApplied = EmployeeFilterCount + EmployerFilterCount

    Best Regards,

    Xianda Tang

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

    • Sarah_Maes's avatar
      Sarah_Maes
      Frequent Visitor
      Hi Anonymous, thank you for your reply!

      When I follow your approach, my issue with counting active filters is partly resolved. When I select only one employer, the count of active filters correctly shows as 1. However, when I select two or more employers, the count shows as zero. I want the result to also show '1' to indicate that a filter is applied to tableX[Employer], regardless of how many employers are selected.

       



      Furthermore, my second problem still remains. When I select 1 employee, the count of active filters will be 2 because tableX[Employee] and tableX[Employer] are from the same table, and an employee can have only one employer. I expect to see a count of 1 when filtering by employee.

      Thank you for your time!

  • FedeMosquera's avatar
    FedeMosquera
    Frequent Visitor

    Hi, I know it's and old topic but I had the same issue and I solved it like this.

    In my case I had one page level filter that excluded only one of the items in dimension A. What I did was count how many filters I had on screen (the _AllSelected Variable) vs how many there were in total (_Allfilters Variable). If that substraction is more than 1 (remember in my case only one item would be filtered out in the page level filters), then it means I have something filtered.

     

    IF (
           (
             VAR _AllFilters = 
                CALCULATE(
                    COUNTROWS(VALUES(DimensionA[Items])),
                    ALL(DimensionA[Items])
                        )
             VAR _AllSelected = COUNTROWS(FILTERS(DimensionA[Items]))
             RETURN
             _AllFilters-_AllSelected
            ) 
        >1, 
        "Filters are applied",
        "No filters applied"
       )

     

    Hope this helps.

     

    Regards,

    Federico