Forum Discussion
How to make the current date
I have year, month, week and day slicer, once the page loading it should show the current date and also it shold be able to filter by the year, month, week and day by manually.
3 Replies
- nandicResident Rockstar
By default, there are no predefined items in slicer. So once you run the report, it will run either "select all" or items that you selected in slicer.
Alternative is to use function selectedvalue which get value from slicer. And it has second parametar which is "alternate result".
So you can make it something like this:Countrows test =var _selectedManager = SELECTEDVALUE(Manager[Manager Name],"Person 2") -- get selected Manager from slicer, if no manager is selected use Person 2RETURNCALCULATE([Countrows],FILTER(Manager,Manager[Manager Name] = _selectedManager))
Also, if you need to show anything by today date, you can use function today() to filter data on today date.- AnonymousNot applicable
Today function wont filter different field, like year,month,day,week, In every slicer it should select the current value.
In that manager case it will select always one value, not dianamically.
- AnonymousNot applicable
Hi Anonymous,
AFAIK, current power bi slicers not excited theatre to pickup a default value or auto-selected items.
I'd like to suggest you use relative mode slicer to auto choose the last date or create a calculated column to compare date with today function to return tag and use it to create a slicer to choose today item to save into a bookmark.
After these steps, you can click on the bookmark to quickly restore the slicer selection of current date.
Regards,
Xiaoxin Sheng