Forum Discussion
Customized Date Slicer by using text values
- 6 years ago
Hi Anonymous ,
How about this?
1. Create a column.
FinalFormat 2 = 'Calendar'[Year] & FORMAT ( 'Calendar'[WeekNumber], "00" )2. Sort [FinalFormat] by [FinalFormat 2].
3. Create two tables and Repeat step 2 in each table.
From = SUMMARIZE('Calendar','Calendar'[FinalFormat],'Calendar'[FinalFormat 2])To = SUMMARIZE('Calendar','Calendar'[FinalFormat],'Calendar'[FinalFormat 2])4. Create a Measure.
Measure = VAR From_ = SELECTEDVALUE ( 'From'[FinalFormat 2] ) VAR To_ = SELECTEDVALUE ( 'To'[FinalFormat 2] ) RETURN SWITCH ( TRUE (), From_ = BLANK () && To_ = BLANK (), 1, From_ = BLANK () && To_ <> BLANK (), IF ( MAX ( 'Calendar'[FinalFormat 2] ) <= To_, 1 ), From_ <> BLANK () && To_ = BLANK (), IF ( MAX ( 'Calendar'[FinalFormat 2] ) >= From_, 1 ), From_ <> BLANK () && To_ <> BLANK (), IF ( MAX ( 'Calendar'[FinalFormat 2] ) >= From_ && MAX ( 'Calendar'[FinalFormat 2] ) <= To_, 1 ) )5. Create two slicers.
6. Create other visuals with "Filters on this visual": [Measure] is 1.
7. Test.
For more details, please check the attached PBIX file.
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 Anonymous ,
How about this?
1. Create a column.
FinalFormat 2 = 'Calendar'[Year] & FORMAT ( 'Calendar'[WeekNumber], "00" )
2. Sort [FinalFormat] by [FinalFormat 2].
3. Create two tables and Repeat step 2 in each table.
From = SUMMARIZE('Calendar','Calendar'[FinalFormat],'Calendar'[FinalFormat 2])To = SUMMARIZE('Calendar','Calendar'[FinalFormat],'Calendar'[FinalFormat 2])
4. Create a Measure.
Measure =
VAR From_ =
SELECTEDVALUE ( 'From'[FinalFormat 2] )
VAR To_ =
SELECTEDVALUE ( 'To'[FinalFormat 2] )
RETURN
SWITCH (
TRUE (),
From_ = BLANK ()
&& To_ = BLANK (), 1,
From_ = BLANK ()
&& To_ <> BLANK (), IF ( MAX ( 'Calendar'[FinalFormat 2] ) <= To_, 1 ),
From_ <> BLANK ()
&& To_ = BLANK (), IF ( MAX ( 'Calendar'[FinalFormat 2] ) >= From_, 1 ),
From_ <> BLANK ()
&& To_ <> BLANK (), IF (
MAX ( 'Calendar'[FinalFormat 2] ) >= From_
&& MAX ( 'Calendar'[FinalFormat 2] ) <= To_,
1
)
)
5. Create two slicers.
6. Create other visuals with "Filters on this visual": [Measure] is 1.
7. Test.
For more details, please check the attached PBIX file.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.