Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Hi All,
I have a simple question on a date slicer but am unable to find a fix for it.
I have a between date slicer. I want the slicer to be by default selected to last 12 weeks(Last 12 weeks based on the field WeekBeginDate that I used for the calendar).
At the same time, user should be able to switch to any weeks that are before 12 weeks.
As far I checked, there is no proper soution for this fix.
Can anyone please help me on this? I would be really a great help for me.
And am not able to attacg the power bi file here? Will anyone help me on houw to upload the file here?
Thanks so much in advance!!
Hi @System0verride Thanks for the reply. The solution which you provided working in a way like the slicer is also defaulting to only the last 12 weeks. I am not able to select any weeks before 12 weeks. But I want tos select previous weeks also in the same slicer. And I don't want to show filter in the report with any flag that the user can edit because of my requirement restrictions.
I would first create a week number calculated column by using the WEEKNUM function in DAX:
WeekNumber = WEEKNUM('Date'[Date], 2)
then I would calculate the most recent week begin day using your WeekBeginDate column and the MAX() function:
MostRecentWeekBeginDate = MAX('Date'[WeekBeginDate])
After that I would figure out the beginning of the last 12 weeks date range using the MostRecentWeekBeginDate Column:
StartOfLast12Weeks =
VAR MostRecentWeek = [MostRecentWeekBeginDate]
RETURN
MostRecentWeek - 84
And finally I would filter WeekBeginDate (the column in the slicer field) by this measure:
WeekBeginDate Filter =
VAR MostRecentWeek = [MostRecentWeekBeginDate]
VAR StartOf12Weeks = MostRecentWeek - 84
RETURN
'Date'[WeekBeginDate] >= StartOf12Weeks && 'Date'[WeekBeginDate] <= MostRecentWeek
Make sure the filter is set by default but the user can edit it.
Hope this helps!
User | Count |
---|---|
89 | |
82 | |
48 | |
40 | |
35 |