Forum Discussion
date slicers influence each other problem
- Anonymous4 years ago
Hi Delphia
Power BI doesn't support you to set default range in slicer. You can set default range in your visual.
Here I build a sample to show you how to create visuals be imapcted by two slicers.
My Sample data is from 2021/08/01 to 2021/10/05.
I build two unrelated tables Date and Period to create slicers by Dax.
Date = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))Period = {"Last Week","Overall","This Month"}Then create a measure as below.
Filter = VAR _LogicPeriod = SWITCH ( SELECTEDVALUE ( Period[Value] ), "Overall", 1, "Last Week", IF ( SUM ( 'Table'[Weeknum] ) = WEEKNUM ( TODAY () ) - 1, 1, 0 ), "This Month", IF ( SUM ( 'Table'[Month] ) = MONTH ( TODAY () ), 1, 0 ), 0 ) VAR _DateRangeStart = MIN ( 'Date'[Date] ) VAR _DateRangeEnd = MAX ( 'Date'[Date] ) RETURN IF ( ISFILTERED ( Period[Value] ), SWITCH ( SELECTEDVALUE ( Period[Value] ), "Overall", 1, "Last Week", IF ( SUM ( 'Table'[Weeknum] ) = WEEKNUM ( TODAY () ) - 1, 1, 0 ), "This Month", IF ( SUM ( 'Table'[Month] ) = MONTH ( TODAY () ), 1, 0 ), 0 ), IF ( ISFILTERED ( 'Date'[Date] ), IF ( MAX ( 'Table'[Date] ) >= _DateRangeStart && MAX ( 'Table'[Date] ) < _DateRangeEnd, 1, 0 ), IF ( SUM ( 'Table'[Month] ) = MONTH ( TODAY () ), 1, 0 ) ) )Create a visual ,add this measure into Filter Field in this visual and set it to show items when value =1.
Result is as below.
By Default visual will show values in this month.
Period slicer has higher level than Date slicer. Select Last week:
Select Overall:
If Period slicer is not selected, then we can filter the visual by range in Date slicer.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Delphia , Default for range is not supported yet.
You need to have a column with that value and select that as the default
Month Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1),"Last Month" ,
eomonth([Date],0)= eomonth(Today(),0),"This Month" ,
Format([Date],"MMM-YYYY")
)
refer if needed
Default Date Today/ This Month / This Year: https://www.youtube.com/watch?v=hfn05preQYA&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=35