Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Date Slicer along with default selection to max date in the data

Hi Team,

 

I need your help in achieving the below.

 

Currently i have a date slicer from which the user can select a particular date or a date range.

 

How do i make this slicer to default to the max date in the data when user logs in for the first time?

1 ACCEPTED SOLUTION
AbhiSSRS
Solution Sage
Solution Sage

Add Today's date in your model :

let
Source = Date.From(DateTime.LocalNow())

in
Source

 

Now you may let your date table to generate from start to this date. Now when you put up a filter on the report that defaults to last date in your range which is today's date. 

 

Now coming to your scenario, you will need to play with bookmarks and filters to have it working :

1. Put a filter on your control and set to default range including today's date as you would like and add it to a bookmark.

AbhiSSRS_0-1617626540177.png

2. Make this bookmark as your default view in case landing from a link or button . 

 

The user will always default to this view when he logs in. 

 

There is also a possibility that you may give a button"Reset" on your page which can again point to this bookmark with latest date.

 

View solution in original post

7 REPLIES 7
AE_7194
New Member

I found a solution on youtube. The "trick" is, you must not touch your Slicer. Don't play with it. As soon as you play with it, it saves the setting. If you don't the end will automatically be the latest date.

Set a Dynamic Changing Date in Date Slicer (Power BI) - YouTube

AbhiSSRS
Solution Sage
Solution Sage

Add Today's date in your model :

let
Source = Date.From(DateTime.LocalNow())

in
Source

 

Now you may let your date table to generate from start to this date. Now when you put up a filter on the report that defaults to last date in your range which is today's date. 

 

Now coming to your scenario, you will need to play with bookmarks and filters to have it working :

1. Put a filter on your control and set to default range including today's date as you would like and add it to a bookmark.

AbhiSSRS_0-1617626540177.png

2. Make this bookmark as your default view in case landing from a link or button . 

 

The user will always default to this view when he logs in. 

 

There is also a possibility that you may give a button"Reset" on your page which can again point to this bookmark with latest date.

 

amitchandak
Super User
Super User

@Anonymous , You can create a flag in your date table like this

 

Is max Date =
var _max = maxx(allselcted(Table), Table[Date])
return
if('Date'[Date]=_max,"MaxDate",[Date]&"")

 

select MaxDate in your slicer and save. Sort this new column on date column

Anonymous
Not applicable

@amitchandak Thanks Amit. But this will return a text column. How do I get the slicer look for this?

@Anonymous , In the column, I have return rest as dates, you can format if needed  and mark date column as sort column so that it can sort on date

 

 

Date 1 =[Date] // use this as sort column

Is max Date =
var _max = maxx(allselcted(Table), Table[Date])
return
if('Date'[Date]=_max,"MaxDate",format([Date],"mm/dd/yyyy"))

 

Refer my video: https://www.youtube.com/watch?v=hfn05preQYA

 

Anonymous
Not applicable

@amitchandak Thanks Amit again. The dates can be converted to a date format. But i cant have this as a slicer like below to allow an user to select a range of dates. 

 

LPD280388_0-1617622881025.png

 

Currently its gives each individual dates in the list/dropdown like below.

 

LPD280388_1-1617622919336.png

 

@Anonymous , I doubt you can initialize Range

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.