cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Yuan_TM
Frequent Visitor

One month Slicer controlling other month slicers with different selection criteria

I have 4 charts each with their own slicers however boss only wants to use one slicer to control all other slicers. The difficulty I am facing is that the first slicer selects single month but the second slicer selects two months, the third slicer selects twelve months. 

 

For example:

If I select May 2021 for slicer 1, I want slicer two to automatically select April and May 2021, I want slicer three to automaticaly select April 2021 all the way to March 2022 (12 months). 

 

Can it be done?  @slicer@Month@Syncing

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @Yuan_TM ,

 

You need to create three date table for three slicers:

 

Table = ADDCOLUMNS(CALENDAR(DATE(2021,1,1),DATE(2022,12,31)),"MonthYear",FORMAT([Date],"MMM")&YEAR([Date]),"DATEVALUE",MONTH([Date])/100+YEAR([Date]))

Table 2 = 'Table'

Table 3 = 'Table 2'

 

Then use the visual level filter for the slicer:

 

Measure1 = 
IF (
    HASONEVALUE ( 'Table'[MonthYear] ),
    IF (
        MAX ( 'Table'[DATEVALUE] ) - 0.01
            = YEAR ( MAX ( 'Table'[Date] ) ),
        IF (
            MAX ( 'Table 2'[DATEVALUE] ) <= MAX ( 'Table'[DATEVALUE] )
                && MAX ( 'Table 2'[DATEVALUE] )
                    >= YEAR ( MAX ( 'Table'[Date] ) ) - 1 + 0.12,
            1,
            0
        ),
        IF (
            MAX ( 'Table 2'[DATEVALUE] ) <= MAX ( 'Table'[DATEVALUE] )
                && MAX ( 'Table 2'[DATEVALUE] )
                    >= MAX ( 'Table'[DATEVALUE] ) - 0.01,
            1,
            0
        )
    ),
    1
)


Measure2 = 
IF (
    HASONEVALUE ( 'Table'[MonthYear] ),
    IF (
        MAX ( 'Table'[DATEVALUE] ) +0.12
            >= YEAR ( MAX ( 'Table'[Date] ) )+0.12,
        IF (
            MAX ( 'Table 3'[DATEVALUE] ) >= MAX ( 'Table'[DATEVALUE] )
                && MAX ( 'Table 3'[DATEVALUE] )
                    <= YEAR ( MAX ( 'Table'[Date] ) ) +1+MONTH(MAX('Table'[Date]))/100-0.01,
            1,
            0
        ),
        IF (
            MAX ( 'Table 3'[DATEVALUE] ) >= MAX ( 'Table'[DATEVALUE] )
                && MAX ( 'Table 3'[DATEVALUE] )
                    <= MAX ( 'Table'[DATEVALUE] ) +0.12,
            1,
            0
        )
    ),
    1
)

 

Add them to corresponding slicers and set them to 1:

 

Capture10.PNG

 

Then it will work as your expected.

 

Please refer to the pbix file.

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

3 REPLIES 3
v-deddai1-msft
Community Support
Community Support

Hi @Yuan_TM ,

 

You need to create three date table for three slicers:

 

Table = ADDCOLUMNS(CALENDAR(DATE(2021,1,1),DATE(2022,12,31)),"MonthYear",FORMAT([Date],"MMM")&YEAR([Date]),"DATEVALUE",MONTH([Date])/100+YEAR([Date]))

Table 2 = 'Table'

Table 3 = 'Table 2'

 

Then use the visual level filter for the slicer:

 

Measure1 = 
IF (
    HASONEVALUE ( 'Table'[MonthYear] ),
    IF (
        MAX ( 'Table'[DATEVALUE] ) - 0.01
            = YEAR ( MAX ( 'Table'[Date] ) ),
        IF (
            MAX ( 'Table 2'[DATEVALUE] ) <= MAX ( 'Table'[DATEVALUE] )
                && MAX ( 'Table 2'[DATEVALUE] )
                    >= YEAR ( MAX ( 'Table'[Date] ) ) - 1 + 0.12,
            1,
            0
        ),
        IF (
            MAX ( 'Table 2'[DATEVALUE] ) <= MAX ( 'Table'[DATEVALUE] )
                && MAX ( 'Table 2'[DATEVALUE] )
                    >= MAX ( 'Table'[DATEVALUE] ) - 0.01,
            1,
            0
        )
    ),
    1
)


Measure2 = 
IF (
    HASONEVALUE ( 'Table'[MonthYear] ),
    IF (
        MAX ( 'Table'[DATEVALUE] ) +0.12
            >= YEAR ( MAX ( 'Table'[Date] ) )+0.12,
        IF (
            MAX ( 'Table 3'[DATEVALUE] ) >= MAX ( 'Table'[DATEVALUE] )
                && MAX ( 'Table 3'[DATEVALUE] )
                    <= YEAR ( MAX ( 'Table'[Date] ) ) +1+MONTH(MAX('Table'[Date]))/100-0.01,
            1,
            0
        ),
        IF (
            MAX ( 'Table 3'[DATEVALUE] ) >= MAX ( 'Table'[DATEVALUE] )
                && MAX ( 'Table 3'[DATEVALUE] )
                    <= MAX ( 'Table'[DATEVALUE] ) +0.12,
            1,
            0
        )
    ),
    1
)

 

Add them to corresponding slicers and set them to 1:

 

Capture10.PNG

 

Then it will work as your expected.

 

Please refer to the pbix file.

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

Thank you very much for the solution

Yuan_TM
Frequent Visitor

Anyone can anwer my query? or do you need more information? 

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors