cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Shahinkmajeed Helper I
Helper I

Set current date as default date in slicer

Dear All,

 

I have a slicer window with a date field as below. On page load, I want this field to auto select the current date. Can somebody please help on this urgently.

 

For e.g today it should auto select 02/09/2018, tomorrow it should be 03/09/2018 and son on. 

image.png

 

Regarsds,

Shahin K

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: Set current date as default date in slicer

Hi @Shahinkmajeed,

 

You can't do this directly in the report designer, but you should be able to do some modelling to make it work. Here I made one sample for your reference.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtNA3sNQ3MFTSUTJUitVBEjICChmhCoFUGaMKGQOFTJRiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t, sale = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}, {"sale", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Date.IsInCurrentDay( [date] )
then "Today"
else [date])
in
    #"Added Custom"

Also you can use DAX to get the similar result.

 

Column2 = IF(Table1[date]=TODAY(),"today",CONCATENATE(Table1[date],""))

 

Here is the result for your reference.

Capture.PNG

 

For more details, please check the pbix as attached.

 

https://www.dropbox.com/s/qbjxrul1ytjjq7d/slicer.pbix?dl=0

 

Regards,

Frank

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
Community Support
Community Support

Re: Set current date as default date in slicer

Hi @Shahinkmajeed,

 

You can't do this directly in the report designer, but you should be able to do some modelling to make it work. Here I made one sample for your reference.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtNA3sNQ3MFTSUTJUitVBEjICChmhCoFUGaMKGQOFTJRiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t, sale = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}, {"sale", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Date.IsInCurrentDay( [date] )
then "Today"
else [date])
in
    #"Added Custom"

Also you can use DAX to get the similar result.

 

Column2 = IF(Table1[date]=TODAY(),"today",CONCATENATE(Table1[date],""))

 

Here is the result for your reference.

Capture.PNG

 

For more details, please check the pbix as attached.

 

https://www.dropbox.com/s/qbjxrul1ytjjq7d/slicer.pbix?dl=0

 

Regards,

Frank

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

Shahinkmajeed Helper I
Helper I

Re: Set current date as default date in slicer

Dear @v-frfei-msft

 

Thank you so much. It worked. 

 

 

Regards,

Shahin 

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors