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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Saffy
New Member

Dynamic Date Filter Toggles

i am very new to PBI, coming from a tableau background!

In tableau i could use a parameter field that would have two options: include and exclude

id then create an if condition, if inlcude then one date range, and if exclude then a different date range. I'd be able to add this a sheet filter.

I seem to be hitting a brick wall in delivering this in PBI. any guides/videos/tutorials or work around would be great

 

info about the data set

Key columns are [order_id], [order_date], [order_date_week]<truncated to monday, [order_date_week_num]

 

it seems to be failing because i want it as a column but this cant connect to a slicer to create that toggle function... any creative suggestions welcome 🙂

8 REPLIES 8
v-sdhruv
Community Support
Community Support

Hi @Saffy ,

Thanks for the update.
It should ideally show the date range when selection is "Include". In the filter, you can select not blank and check if the value is showing correct number.

Thank You.


v-sdhruv
Community Support
Community Support

Hi @Saffy ,

Just wanted to check if you got a chance to review the suggestion provided and whether that helped you address your query?

Thank You

ok my table is called sales

IsInDateRange =
VAR Selection = SELECTEDVALUE('Include/Exclude'[Parameter], "Include")
RETURN
CALCULATE(
    COUNTROWS('Sales'),
    FILTER(
        'Sales',
        IF(
            Selection = "Include",
            'Sales'[order_date] >= TODAY()-3,
             'Sales'[order_date] < TODAY()-3
        )
    )
)

so i've updated the formula and created it as a measure, but when i drag it onto a visual what do i filter these are the options
Saffy_0-1762339529543.png

 



v-sdhruv
Community Support
Community Support

Hi @Saffy ,

In each visual (e.g., net sales, margin, etc.), add a filter: IsInDateRange= True

This way, the visual only shows data based on the selected toggle.

You don’t need to recreate this for every metric. Just use this IsInDateRange measure as a filter across visuals. Your actual metrics (like Net Sales, Margin, etc.) stay untouched.

Regards,
Shruti

Shahid12523
Community Champion
Community Champion

- Create a disconnected table with values like "Include" and "Exclude".
- Use a slicer on that table to let users choose.
- Write a DAX measure that checks the slicer selection and applies different date logic.
- Filter visuals using that measure (e.g., [IsInDateRange] = TRUE).

Shahed Shaikh

It wouldn't let me create a measure from a column

MasonMA
Community Champion
Community Champion

Hi, 

After you created a disconnected table with below logic, 

MasonMA_2-1760883711154.png

Create a Measure, for example with below logic to show Past 3 days 'Request count' when user selects 'Include'. 

IsInDateRange = 
VAR Selection = SELECTEDVALUE('ParameterTable'[Parameter], "Include")
RETURN
CALCULATE(
    COUNTROWS('Request'),
    FILTER(
        'Request',
        IF(
            Selection = "Include",
            'Request'[Created Date] >= TODAY()-3,
             'Request'[Created Date] < TODAY()-3
        )
    )
)

MasonMA_0-1760888041756.png

 

Do I have to do that for each calculation , like for each metric? Each measure or can that be applied to the filter
I have a few, net sales, margin, count orders, count of products etc..

av

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.