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
game1
Helper II
Helper II

Filter last 7 days and 60 days with date range slicer or in Segment

I need help on filter last 7 days and 60 days. Suppose I have Table1[dateExam]. How could I have the return of the last 60 days, using the date range slicer ? For example, for this one, I want that if I select 06/30/2021, I would have the return of all the day beetween 04/30/2021 and 06/30/2021. If I select in the slicer range 01/05/2023, I would have for the return of the last 60 days, all the day beetween 11/05/2022 and 01/05/2023. When I try fron Today(), it seems to wotrk, but I want for all range date also. So I want that for a date I select like 01/05/2023 in Segment, it return me the last 7 days and the last 60 days. 

Thanks!

Capture d’écran, le 2024-01-05 à 01.48.16.png

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

Hi  @game1 ,

 

As far as I know, the between slicer can't do that for now, the between slicer can only set the date range filter in Filter to change the above

Create a relative date slicer or filter in Power BI - Power BI | Microsoft Learn

You can use the Vertical list slicer.

 

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
DISTINCT('Table'[Date])

vyangliumsft_0-1704871040802.png

2. Create measure.

Flag =
var _maxdate=SELECTEDVALUE('Table 2'[Date])
var _mindate=EOMONTH(_maxdate,-2)
return
IF(
    MAX('Table'[Date]) >= _mindate && MAX('Table'[Date])<=_maxdate,1,0)

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

vyangliumsft_1-1704871040802.png

4. Result:

vyangliumsft_2-1704871174547.png

 

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

Hello, 

It not working wery well. 

I have Table1[dateExam] and Table1[numberPeople].

First, I need to use a CALENDAR (range slicer) to select a date (it must only consider the max date of range slicer selected). For example, I can select 10/01/2021 as my maximum date.

Second, I need to check one of the options: (in Segment). For example, I can check the option “last 7 days”.

Then, it would return me the numberPeople for the “last 7 days” of the selected date in the CALENDAR.(So the “last 7 days” is base on the CALENDAR (range slicer) I have selected.)

In other words, it would return me in a graphic, the numberPeople between 03/01/2021 and 10/01/2021.

For this example, in a graphic, I would have for each day between 03/01/2021 and 10/01/2021, the numberPeople that have done dateExam from Table1[dateExam].

Thanks!

Capture d’écran, le 2024-01-14 à 03.04.23.pngCapture d’écran, le 2024-01-14 à 03.04.46.png

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.