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
abloor
Helper IV
Helper IV

Filter a date slicer after making a selection in another date slicer

Hi, 

I have 2 date slicers on my page, each fed from a different calendar.

 

The first allows users to selected the SaleWeek where our sales team agreed their sale with the client and input it into the system. This slicer has a field from the SaleDateCalendar.

 

The second allows users to choose months & years, to see where our revenue for the sale is booked. (We have a subscription based service so the revenue will be booked on certain SaleDate, but the money from the subscription will fall across many future months.) This slicer has a field from the MainCalendar.

 

When a date is chosen in the SaleDate slicer, I want the MainCalendar slicer to filter and only show the month/years that are greater than or equal to the month/year in the SaleDate slicer.

 

Is this possible please? Everything I've tried hasn't worked and I'm at a dead end.

 

Thanks very much.

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

Hi,  @abloor 

Try the measure formula as below and  apply it to the visual filter pane.

Measure1 = 
VAR year1 =
    YEAR ( SELECTEDVALUE ( Table1[SaleDate] ) )
VAR monthno =
    MONTH ( SELECTEDVALUE ( Table1[SaleDate] ) )
VAR year2 =
    SELECTEDVALUE ( Table2[MainCalendar].[Year] )
VAR monthno2 =
    SELECTEDVALUE ( Table2[MainCalendar].[MonthNo] )
RETURN
    IF ( ( year2 = year1 && monthno2 >= monthno ) || ( year2 > year1 ), 1, 0 )

6.png

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi,  @abloor 

Try the measure formula as below and  apply it to the visual filter pane.

Measure1 = 
VAR year1 =
    YEAR ( SELECTEDVALUE ( Table1[SaleDate] ) )
VAR monthno =
    MONTH ( SELECTEDVALUE ( Table1[SaleDate] ) )
VAR year2 =
    SELECTEDVALUE ( Table2[MainCalendar].[Year] )
VAR monthno2 =
    SELECTEDVALUE ( Table2[MainCalendar].[MonthNo] )
RETURN
    IF ( ( year2 = year1 && monthno2 >= monthno ) || ( year2 > year1 ), 1, 0 )

6.png

Best Regards,
Community Support Team _ Eason

Thanks very much @v-easonf-msft .  This has worked perfectly.  

Thank you for your clear response and example images - I was able to implement your idea in 1 min 😀

amitchandak
Super User
Super User

@abloor , Create a measure in the fact where this main calendar is joined

example

measure =

var _max =maxx(allselected(salescal), sales[date])

return

countrows(filter(sales, sales[date]>=_max))

 

In the main calendar slicer use this measure as visual level filter, check for non blank

 

Very similar approch discussed here

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.