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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
cv2qm
Helper I
Helper I

Set default Today in Slicer date and also select date

Hello community,

 

I am implementing a date picker in slicer. I achived that by using 'before' option in slicer, and wrote DAX measure to bring selected date related value. 

Calender table has dates from 2018 to 2023. 

I want to set slicer Date to Today. How can i do this?

Don't want to use relative Date option. 

 

Capture.PNG

 
 

Below Dax measure I am using to bring selected date event. That works fine.  

 

 

Selected day Event = 
Var selectedate = MAX('Calender Table'[Date])
return 
CALCULATE(MIN(Data[Event Name]),TREATAS({selectedate},'Calender Table'[Date]))

 

 

Any suggestions please. 

 

Thanks !

1 ACCEPTED SOLUTION

@cv2qm
It's not currently possible to have both date picker and relative date option, nor is it possible to set a relative default (like today) for a slicer.

https://ideas.powerbi.com/ideas/idea/?ideaid=0eab4ba7-b039-4785-9414-b8c94ab06e25

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

7 REPLIES 7
V-pazhen-msft
Community Support
Community Support

@cv2qm 

You can create another column in the calendar table to get the date from the beginning to today. Then use 'Before' option in the slicer.

Date-Today = IF([Date]<=TODAY(),[Date])

 date-today.JPG

 


Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1. I want to show report default for today everytime. 

2. User can pick any date if he/she want to search.

 

But in your case it will always show today's date.

 

@cv2qm
It's not currently possible to have both date picker and relative date option, nor is it possible to set a relative default (like today) for a slicer.

https://ideas.powerbi.com/ideas/idea/?ideaid=0eab4ba7-b039-4785-9414-b8c94ab06e25

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

amitchandak
Super User
Super User

@cv2qm , there is way initialize on a function like today. 

You can have a column like this in you date table sorted on date and use that to filter today

 

Date Type = SWITCH(TRUE(),'Date'[Date]=TODAY(),"Today"
,'Date'[Date]=TODAY()-1,"Yesterday"
,'Date'[Date]=TODAY()-2,"2 Days Ago"
,'Date'[Date]&"")

 

In case you need more than a day data when you select only today -

https://www.youtube.com/watch?v=duMSovyosXE

AllisonKennedy
Super User
Super User

You can only use the built in relative date filters on the slicer, so if you are using 'before' you cannot set it to always be today. Do you ever need it to show future dates? You could add a filter to the slicer to only show dates in the past 3? 10? years so that it only goes until today?

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

I just want to show today's date in sllicer always, if i can use relative date in filters how can i set slicer today's date always. 

User can pick any date from Slicer.

 

Thanks! 

@cv2qm 

 

Power bi doesn't support set default option in a slicer. However, there is a workaround that is possible by creating a measure to show today()'s data when nothing selected in the slicer, meanwhile you can select other dates in the slicer, please see the attached pbix.

 

default slicer.JPG

Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.