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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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 @Anonymous ,

 

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 @Anonymous ,

 

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

Anonymous
Not applicable

Thank you very much for the solution

Anonymous
Not applicable

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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