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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
koorosh
Post Partisan
Post Partisan

Create Slicer

Hi, Please check the attached file (testdays.pbix). I need a slicer on page one including 3 options.
Option1- filter table visual based on dafediff >60.

Option2- filter table visual based on datediff>100.

Option3- filter table visual based on dafediff>900.

 

I want a slicer like that one in the test.pbix attached.

 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

You need to add the Min field to the MeasureListTable and make sure it is a number.

jdbuchanan71_1-1688851764412.png

The SelectedMeasure should be loooking at the Min column.

SelectedMeasure = SELECTEDVALUE(MeasureListTable[Min])

Then you write the filter measure and apply it as a filter on your table.

Filter Measure = 
VAR _Days = [SelectedMeasure]
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( VALUES ( 'Table'[DifferenceDays] ), 'Table'[DifferenceDays] >= _Days )
    )

 

jdbuchanan71_3-1688851952216.png

I have attached your file with my updates.

 

 

 

View solution in original post

4 REPLIES 4
jdbuchanan71
Super User
Super User

You need to add the Min field to the MeasureListTable and make sure it is a number.

jdbuchanan71_1-1688851764412.png

The SelectedMeasure should be loooking at the Min column.

SelectedMeasure = SELECTEDVALUE(MeasureListTable[Min])

Then you write the filter measure and apply it as a filter on your table.

Filter Measure = 
VAR _Days = [SelectedMeasure]
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( VALUES ( 'Table'[DifferenceDays] ), 'Table'[DifferenceDays] >= _Days )
    )

 

jdbuchanan71_3-1688851952216.png

I have attached your file with my updates.

 

 

 

jdbuchanan71
Super User
Super User

On the Days Filter table you should also sort the [Days Range] solumn by the [Min] Column so they appear in the correct order.

jdbuchanan71
Super User
Super User

We can add a selection table that has the minimum days in it to use as a filter.  Create a new table with this dax code.

Days Filter = 
DATATABLE (
    "Days Range", STRING,
    "Min", INTEGER,
    {
        { "All", 0 },
        { "> 60 days", 60 },
        { "> 100 days", 100 },
        { "> 900 days", 900 }
    }
)

Then a measure to read the selection

Selected Option = SELECTEDVALUE ( 'Days Filter'[Min], 0 )

Then the mesure that will filter the table.

Filter Measure = 
VAR _Days = [Selected Option]
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( VALUES ( 'Table'[DifferenceDays] ), 'Table'[DifferenceDays] >= _Days )
    )

You can add that measure to the visual, set a filter on the field to [Filter Measure] is not blank.

jdbuchanan71_0-1688767861768.png

You can then remove the [Filter Measure] from the table and it will keep the filter.

jdbuchanan71_1-1688767912178.png

I have attached my sample file for you to look at.

 

Thank you for your reply. I should read it carefully so please give me time.
Meantime could you please check my attached file and let me know which command I should add to the switch command in 'Dynamicmeasure' measure so that it filters the table visual based on the selected vaule?

Thanks in advance.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.