Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
Please provide suggestions on how to create default settings on a calendar slicer -- so it defaults to start of the current year (i.e., 1/1/2024 or 1/1/2025 next year) and ends in the current date i.e., 11/17/2024 for today.
The user should also have the flexibility to extend the date range in the slicer earlier than first day of the current year or beyond today.
Many thanks,
Pav
Solved! Go to Solution.
Hi @pbidani You can achieve this by using a calculated column and use that column to filter the slicer to show the default date range initially.
Considering You have date table set up. If not you can create a date table using the code below:
DateTable =
ADDCOLUMNS(
CALENDAR(DATE(2020,1,1), DATE(2025, 12, 31)),
"Year", YEAR([Date]),
"Month", MONTH([Date]),
"Day", DAY([Date])
)
Then create a new column to identify the default date range:
IsDefaultDate =
IF(
[Date] >= DATE(YEAR(TODAY()), 1,1) && [Date] <= TODAY(),
1,
0
)
Add the [Date] field from your date table to the slicer. Use the IsDefaultDate column to filter the slicer to show the default date range initially. See image:
This meets your first requirement.
To achieve the second requirement, which is the flexibility to extend the date range in the slicer earlier than first day of the current year or beyond today, You need to use bookmark.
So, I have created 2 slicer, one for default range and one for all range. Then place both on top of another and set up a bookmark nevigator button. You can create your own tiny button to switch slicer. See image:
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
Create a measure:
IsInDefaultRange =
IF(
'DateTable'[Date] >= DATE(YEAR(TODAY()), 1, 1) &&
'DateTable'[Date] <= TODAY(),
1,
0
)
Add this measure to visual level filter and filter for '1'
💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
Hi @pbidani You can achieve this by using a calculated column and use that column to filter the slicer to show the default date range initially.
Considering You have date table set up. If not you can create a date table using the code below:
DateTable =
ADDCOLUMNS(
CALENDAR(DATE(2020,1,1), DATE(2025, 12, 31)),
"Year", YEAR([Date]),
"Month", MONTH([Date]),
"Day", DAY([Date])
)
Then create a new column to identify the default date range:
IsDefaultDate =
IF(
[Date] >= DATE(YEAR(TODAY()), 1,1) && [Date] <= TODAY(),
1,
0
)
Add the [Date] field from your date table to the slicer. Use the IsDefaultDate column to filter the slicer to show the default date range initially. See image:
This meets your first requirement.
To achieve the second requirement, which is the flexibility to extend the date range in the slicer earlier than first day of the current year or beyond today, You need to use bookmark.
So, I have created 2 slicer, one for default range and one for all range. Then place both on top of another and set up a bookmark nevigator button. You can create your own tiny button to switch slicer. See image:
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
Hi @pbidani ,
To create default settings on a calendar slicer in Power BI, you can use a calculated column in the calendar table to flag dates within the default range, from the start of the current year to today. This can be done using a DAX formula like IF([Date] >= DATE(YEAR(TODAY()), 1, 1) && [Date] <= TODAY(), 1, 0). Additionally, a measure can be created to dynamically control the slicer, ensuring it highlights only dates within this default range when the report loads.
In the report, add the calendar slicer and configure it to allow the selection of any date in the full range. To set defaults, use a filter on the slicer visual to show only dates flagged as part of the default range, but avoid restricting the data selection entirely to allow user flexibility. For finer control, you can manually set a default date range on the slicer in Power BI Desktop before publishing the report. This setup ensures the slicer defaults to the start of the current year through today but remains adjustable for users to extend the range earlier or later as needed.
Best regards,
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |