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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
tbrown33
Regular Visitor

Dynamic input for filters

Does power bi have the ability to build something like an input box where a user can enter a number and filtering is done according to that number.

 

for example the ability to show sales and quantity sold over a period of time and the user can decide if they want to see it by the past 7 days,  45 days,  180 days.   Whichever they would prefer to see.  

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @tbrown33 ,

 

I suggest you to use what if parameter to create a slicer.

For reference: Create and use what-if parameters to visualize variables in Power BI Desktop

In my sample I create a 'Past Days' parameter from 1 to 200 and Increment is 1. My data table contains quantities from 2021/01/01 to today. In my example, for ease of calculation, the daily quantity is 1.

Past N days Quantity = 
VAR _INPUT_DAYS =
    SELECTEDVALUE ( 'Past Days'[Past Days] )
VAR _QUANTITY =
    CALCULATE (
        SUM ( 'Table'[Quantity] ),
        FILTER (
            'Table',
            'Table'[Date] < TODAY ()
                && 'Table'[Date]
                    >= TODAY () - _INPUT_DAYS
        )
    )
RETURN
    _QUANTITY

Result is as below.

Past 7 days:

RicoZhou_0-1654508286781.png

Past 180 days:

RicoZhou_1-1654508308413.png

 

Best Regards,
Rico Zhou

 

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

View solution in original post

3 REPLIES 3
tbrown33
Regular Visitor

Thanks, someone showed me the relative date option within the slicer.  This will be the option my users would enjoy using.

tbrown33_0-1654526007544.png

 

Anonymous
Not applicable

Hi @tbrown33 ,

 

I suggest you to use what if parameter to create a slicer.

For reference: Create and use what-if parameters to visualize variables in Power BI Desktop

In my sample I create a 'Past Days' parameter from 1 to 200 and Increment is 1. My data table contains quantities from 2021/01/01 to today. In my example, for ease of calculation, the daily quantity is 1.

Past N days Quantity = 
VAR _INPUT_DAYS =
    SELECTEDVALUE ( 'Past Days'[Past Days] )
VAR _QUANTITY =
    CALCULATE (
        SUM ( 'Table'[Quantity] ),
        FILTER (
            'Table',
            'Table'[Date] < TODAY ()
                && 'Table'[Date]
                    >= TODAY () - _INPUT_DAYS
        )
    )
RETURN
    _QUANTITY

Result is as below.

Past 7 days:

RicoZhou_0-1654508286781.png

Past 180 days:

RicoZhou_1-1654508308413.png

 

Best Regards,
Rico Zhou

 

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

lbendlin
Super User
Super User

That is standard functionality in the filter pane. All you need to do (in the options) is to allow report users to change filter types.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.