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
RyndaRaw
Helper I
Helper I

Default date slicer to a rolling date and display the actual date in the slicer.

Is it possible to create a date slicer that will show the actual date for 2 days ago and dynamically update that default to the next date everyday?

 

To elaborate:

 

if today is 1/5/20, I want the date slicer to default to 1/3/20.

when I go into the report tomorrow, 1/6/20, the date slicer will now default to 1/4/20.

if it is a weekend, so I go in 1/7/20 (and lets pretend it's a Sat), the date slicer will default to 1/6/20 (last weekday)

 

I've seen examples where one can create a value and always default to that assigned value but I want to see the actual date displayed rather than say a "As of 2 days ago" value.

Is this possible?

1 ACCEPTED SOLUTION

I've read several forumns and even reached out to Microsoft Developers for help. It doesn't look like there's a DAX solution for this. However, I was able to create a slicer w/the text field "Latest" that would default to the date I want. I then overlaid a card on the slicer to the right that would show the date for "Latest". Not an ideal solution but it works for now.

View solution in original post

8 REPLIES 8
Raul_Vinuesa
Frequent Visitor

You could try this and addapt to you:

How to set a DATE SLICER to TODAY by default in Power BI - Bing video

I have the same issue and trying to apply that to my report. I want to mark by default last date within data which it is no exactly the content of the video. In my case it works when I see data from tuesday to thursday (take into account I have filtered yerterday by default and have no data at weekends).

Hope it helps.

v-yingjl
Community Support
Community Support

Hi @RyndaRaw ,

 

If you've fixed the issue on your own please kindly share your solution. If the above posts help, please kindly mark it as a solution to help others find it more quickly. Thanks!


Best Regards,
Yingjie Li

I've read several forumns and even reached out to Microsoft Developers for help. It doesn't look like there's a DAX solution for this. However, I was able to create a slicer w/the text field "Latest" that would default to the date I want. I then overlaid a card on the slicer to the right that would show the date for "Latest". Not an ideal solution but it works for now.

v-yingjl
Community Support
Community Support

Hi @RyndaRaw ,

Based on my researcn, the default selected slicer is not supported in power bi currently. One of the solutions is like @mahoneypat  mentioned to create a dynamic column in the slicer.

You can also try this solutions to meet part of your requirement:

  1. Use relative date slicer / filters, please refer this document: Creating a relative date slicer and filter in Power BI 
  2. Create a measure in the card to show the previous 2 days date directly:

 

Measure =
VAR _date =
    SELECTEDVALUE ( 'Table'[date] )
RETURN
    IF (
        _date = BLANK (),
        TODAY () - 2,
        IF ( WEEKDAY ( TODAY (), 2 ) = 6, TODAY () - 1, TODAY () )
    )

 

 

result.png

Refer this simliar issue: Setting default date in a slicer 

In addition, here is an idea about default selected slicer, you can vote for it to help us improve power bi and make this feature coming sooner.

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Add a column to your date table that calculates "default date". Then use that column to filter your date table appropriately.

 

Example:

DateRolling Date
1/5/20201/3/2020
1/6/20201/4/2020
1/7/20201/6/2020

If I refresh the report the next day, it doesn't apply the most current date. It will still default on the last date selected.

Add a dynamic column to your Date table with an expression like - 

 

Default Date = If(DATEDIFF('Date'[Date], TODAY(),DAY)=2, "Default", "NotDefault")
 
You can then have a slicer on your Date column and filter the slicer where Default Date = "Default".
 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


I forgot to add that it should default to the date but also still show all the other dates for the report user to select if they wanted to change it.

 

If i add the filter to only show "default", it won't show the other dates in the slicer. 

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.