The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.
ID | Date |
ABCD | 5/31/2021 |
ABCD | 4/30/2021 |
ABCD | 3/31/2021 |
ABCD | 2/28/2021 |
ABCD | 1/31/2021 |
ABCD | 12/31/2020 |
ABCD | 11/30/2020 |
ABCD | 10/31/2020 |
ABCD | 9/30/2020 |
ABCD | 8/31/2020 |
ABCD | 7/31/2020 |
ABCD | 6/30/2020 |
ABCD | 5/31/2020 |
ABCD | 4/30/2020 |
ABCD | 3/31/2020 |
ABCD | 2/29/2020 |
ABCD | 1/31/2020 |
ABCD | 12/31/2019 |
ABCD | 11/30/2019 |
ABCD | 10/31/2019 |
ABCD | 9/30/2019 |
ABCD | 8/31/2019 |
ABCD | 7/31/2019 |
ABCD | 6/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:
ID | Date |
ABCD | 2/28/2021 |
ABCD | 11/30/2020 |
ABCD | 8/31/2020 |
ABCD | 5/31/2020 |
ABCD | 2/29/2020 |
ABCD | 11/30/2019 |
Please help me achieve his. Thanks in advance.
Solved! Go to Solution.
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 )
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 )
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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