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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MM365
Frequent Visitor

Date Range Slicer Ignoring Second Date.

I noticed that when using the slicer visual with a date column and setting it to between, the second date gets calculated as is before instead of is on or before.

I have a regular model (fact, dimension, and date table).
The data is up to date.
The relationships are okay.
I use the date column from the date table in the slicer.
I needed to filter the slicer to only let you select dates up until today so I used a day offset column and filtered the slicer to day offset is less than 1. (day offset is a column that has a 0 for today, a 1 for tomorrow, and a -1 for yesterday, ..., ...)

Lets say I select 1/1/2022 and 1/10/2022 in the slicer (today is 7/6/2022), when you use the filter icon on any of the other visuals on the page you'll see is on or after Saturday, January 01, 2022 and is before Tuesday, January 11, 2022, but if I select 7/6/2022 as the second date you'll only see is on or after Saturday, January 01, 2022 and the report only gets filtered to on or after 1/1/2022 but it goes till the end of my date table.
The reason that this happens is because Power BI tries to write the second date filter as and is before Thursday, July 07, 2022 but my day offset filter on the slicer visual doesn't allow selecting 7/7/2022.

@ power BI Team please update the calculation for the second date in the slicer to be calculated as on or before. Thanks.

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @MM365 ,

I created some data:

vyangliumsft_0-1657525089850.png

Here are the steps you can follow:

1. Create measure.

Flag =
var _today=TODAY()
var _min=MINX(ALLSELECTED('Table'),'Table'[Date])
return
IF(
MAX('Table'[Date]) >=_min &&MAX('Table'[Date])<=_today,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1657525089850.png

3. Result:

vyangliumsft_2-1657525089852.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

Hi @v-yangliu-msft,
Thanks for trying to answer my question but unfortunately you just duplicated my problem.

I'll explain.
My problem wasn't that I can't select today's date in the slicer, my problem was that when I did select today's date in the slicer it didn't filter the report to only include dates until today.

If you check your report you'll see that when you select today's date the table visual doesn't stop at today's date.

There are three ways you can check this.
Scroll on the table visual and see dates past today.
Hover over the filter icon on the table visual and it won't say that the table is being filtered to only include dates until today.
Copy the query using the performance analyzer and then open it in dax studio and you won't see a filter to only show dates until today.

Thanks again!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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