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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
TheV500Oshin
Regular Visitor

Filter out rows in a table using a button or toggle

Hello

 

I need a way of a button/toggle to filter out rows based on a string.

 

I have created a small table with the fields "Yes" or "No" and I need to filter a table depending on which button is pressed.

For example I have a field called JobTitle and if I press "Yes" I need to show all the rows that doesn't contain "CEO" and when I untick "Yes" I need to return all the fields back that does contain "CEO".

 

I don't want to use bookmarks but if there is another way of doing this that would be great.

 

Thanks

Oshin

1 ACCEPTED SOLUTION

@TheV500Oshin Here is the sample file with the solution https://www.dropbox.com/t/zcapitgXbnBiz4nX
The report looks like this 1.png2.png
This is the measure code

Measure = 
VAR Selection =
    IF ( 
        ISFILTERED ('Is CEO'[CEO?] ),
        CALCULATE (
            VALUES ( Employees[Jobtitle] ),
            Employees[Jobtitle] = "CEO"
        ),
        CALCULATE (
            VALUES ( Employees[Jobtitle] ),
            Employees[Jobtitle] <> "CEO"
        )
    )
VAR Result =
    IF (
        HASONEVALUE ( Employees[EMPID] ),
        Selection
    )
RETURN
    Result 

Please let me know if this answers your query or if you need any further modifications. 

View solution in original post

8 REPLIES 8
tamerj1
Super User
Super User

Hi @TheV500Oshin 
Can share some screen shots of what your data looks like and what exactly you want to filter?

Thankl you

Hello,

 

I cannot share screenshot as it sensitive data. I need to be able to filter out the string "CEO" from a column called Jobtitle but it has to be using a toggle for the user.

Two buttons are ok ( Yes, No ) or you need only one ( Yes )?

Two buttons is fine thank you

@TheV500Oshin Here is the sample file with the solution https://www.dropbox.com/t/zcapitgXbnBiz4nX
The report looks like this 1.png2.png
This is the measure code

Measure = 
VAR Selection =
    IF ( 
        ISFILTERED ('Is CEO'[CEO?] ),
        CALCULATE (
            VALUES ( Employees[Jobtitle] ),
            Employees[Jobtitle] = "CEO"
        ),
        CALCULATE (
            VALUES ( Employees[Jobtitle] ),
            Employees[Jobtitle] <> "CEO"
        )
    )
VAR Result =
    IF (
        HASONEVALUE ( Employees[EMPID] ),
        Selection
    )
RETURN
    Result 

Please let me know if this answers your query or if you need any further modifications. 

Samarth_18
Community Champion
Community Champion

Hi @TheV500Oshin ,

 

You can create a bookmark with filter then add a button and put bookmark as action for your button.

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Is there anyway of doing this without bookmarks? 

@TheV500Oshin Create two pages one with filter and another with without filter and put button action as navigation to other page. Mark newly created page as hidden so user will not see in services.

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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