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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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