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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
mysasai
Frequent Visitor

Filter a table (visual) with three or six months gap based on another date slicer filter

I have a data with month end dates like table below. I need two filters, one is a regular slicer with date column in it. and other filter that contains 3 Months, 6 Months as options to select. 

 

IDDate
ABCD5/31/2021
ABCD4/30/2021
ABCD3/31/2021
ABCD2/28/2021
ABCD1/31/2021
ABCD12/31/2020
ABCD11/30/2020
ABCD10/31/2020
ABCD9/30/2020
ABCD8/31/2020
ABCD7/31/2020
ABCD6/30/2020
ABCD5/31/2020
ABCD4/30/2020
ABCD3/31/2020
ABCD2/29/2020
ABCD1/31/2020
ABCD12/31/2019
ABCD11/30/2019
ABCD10/31/2019
ABCD9/30/2019
ABCD8/31/2019
ABCD7/31/2019
ABCD6/30/2019

 

If  9/30/2019 and 2/28/2021 are selected as start and end dates on 1st filter/slicer, and 3 months as in second filter, the table visual should show something similar below:

 

IDDate
ABCD2/28/2021
ABCD11/30/2020
ABCD8/31/2020
ABCD5/31/2020
ABCD2/29/2020
ABCD11/30/2019

 

Please help me achieve his. Thanks in advance.

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @mysasai ,

 

Try this:

Measure =
VAR SelectedMonthInterval_ =
    SELECTEDVALUE ( 'Month Interval'[Month Interval] )
VAR Rank_ =
    RANKX (
        ALLSELECTED ( 'Table' ),
        CALCULATE ( MAX ( 'Table'[Date] ) ),
        ,
        DESC,
        DENSE
    )
VAR Mod_ =
    MOD ( Rank_, SelectedMonthInterval_ )
RETURN
    IF ( Mod_ = 1, 1 )

interval.PNG

 

 

 

Best Regards,

Icey

 

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
Icey
Community Support
Community Support

Hi @mysasai ,

 

Try this:

Measure =
VAR SelectedMonthInterval_ =
    SELECTEDVALUE ( 'Month Interval'[Month Interval] )
VAR Rank_ =
    RANKX (
        ALLSELECTED ( 'Table' ),
        CALCULATE ( MAX ( 'Table'[Date] ) ),
        ,
        DESC,
        DENSE
    )
VAR Mod_ =
    MOD ( Rank_, SelectedMonthInterval_ )
RETURN
    IF ( Mod_ = 1, 1 )

interval.PNG

 

 

 

Best Regards,

Icey

 

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

amitchandak
Super User
Super User

@mysasai , I explained this approch in video from this time onward

https://youtu.be/44fGGmg9fHI?t=870

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak

 

Appreciate your quick response. 

 

I have gone through your video, it is close to but not exactly what I need.

 

Could you please tweak the measure code for me, so that I can get data with 3 months gap between them but not last 3 months. 

 

Thanks,

Sai

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors