Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
Hi guys,
I was wondering if you might help me with something that I had been struggling with for a week, so this is the case.
I have a report which contains two slicers, 1 contains the months and the other one contains the weeks from that month.
So what I want to achieve is that when the user filters for eg. April from the slicer of months, and then he wants to view the other slicer of the weeks, there is always a default value selected, in which case could be the first week of that month.
I tried to do some DAX but I had no results,
I would appreciate it if you could help me.
Thanks,
Regards,
Solved! Go to Solution.
Hi @sebastianjpue ,
I want to acknowledge valuable input provided by @rajendraongole1 . Their initial ideas help guide my approach. However, I noticed that more details are needed to fully understand this issue.
(1)We create a custom visual. Get more visuals->search Preselected Slicer.
(2)We can create a measure.
_FirstWeek =
VAR _SelectedWeek = SELECTEDVALUE('DateTable'[Week])
VAR _FirstWeekOfMonth =
CALCULATE(
MIN('DateTable'[Week]),
FILTER(
ALLSELECTED(DateTable),
'DateTable'[Month] = SELECTEDVALUE('DateTable'[Month]) &&
'DateTable'[Year]= SELECTEDVALUE('DateTable'[Year])
)
)
RETURN
_SelectedWeek =_FirstWeekOfMonth
(3) We can create a table.
_PreselectedSlicer = DATATABLE(
"IsDirtySlicer1", BOOLEAN,
{
{FALSE()},
{TRUE()}
}
)
(4) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @sebastianjpue ,
I want to acknowledge valuable input provided by @rajendraongole1 . Their initial ideas help guide my approach. However, I noticed that more details are needed to fully understand this issue.
(1)We create a custom visual. Get more visuals->search Preselected Slicer.
(2)We can create a measure.
_FirstWeek =
VAR _SelectedWeek = SELECTEDVALUE('DateTable'[Week])
VAR _FirstWeekOfMonth =
CALCULATE(
MIN('DateTable'[Week]),
FILTER(
ALLSELECTED(DateTable),
'DateTable'[Month] = SELECTEDVALUE('DateTable'[Month]) &&
'DateTable'[Year]= SELECTEDVALUE('DateTable'[Year])
)
)
RETURN
_SelectedWeek =_FirstWeekOfMonth
(3) We can create a table.
_PreselectedSlicer = DATATABLE(
"IsDirtySlicer1", BOOLEAN,
{
{FALSE()},
{TRUE()}
}
)
(4) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, thanks for your reply,
I did in my report the above, it almost approaches what I'm searching for. I just have 1 problem with the solution, when the week is "pre-selected", I only can view 1 month in my other slicer, the one that is currently "selected", how did you manage to see another month in your slicer in the example above, maybe I'm missing something.
Thanks in advance,
Best regards.
Sebastian
I solved it, it was the interactions, thank you so much for your solution.
Best regards,
Sebastian
Hi @sebastianjpue - Ensure your Calendar table is related to your fact table on the date key and create a measure to determine the first week of the selected month
FirstWeekOfMonth =
CALCULATE(
MIN(Calendar[Week]),
FILTER(
ALLSELECTED(Calendar),
Calendar[MonthNumber] = SELECTEDVALUE(Calendar[MonthNumber]) &&
Calendar[Year] = SELECTEDVALUE(Calendar[Year])
)
)
create another measure to select the first week condition as below:
IsFirstWeek =
IF(
SELECTEDVALUE(Calendar[Week]) = [FirstWeekOfMonth],
1,
0
)
Set the filter to show only when IsFirstWeek is equal to 1 for visual level filter and Add a slicer for the months using the Calendar[Month] column.
Add another slicer for the weeks using the Calendar[WeekStart] column
Try the above approach and let know
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
User | Count |
---|---|
92 | |
91 | |
84 | |
80 | |
49 |
User | Count |
---|---|
146 | |
137 | |
109 | |
68 | |
55 |