Forum Discussion
Default value for filters
You can definitely set the filters for the report for defaults, just adjust the values in the Filters area and save the report. However, if someone updates the filters and saves the report, it will change the default. However, if they change the filter and do not save, you will be fine.
Programmatic is not possible right now I believe, you can put a formula like "TODAY()" in the filter and when you apply it, it changes to today's date, but I do not believe that it persists as a formula right now or that you can put in something like "TODAY()-14" for example.
mebabTo extend Greg_Deckler suggestion you can add a calculated column in your Date table sort of like this
1. Switch ( TRUE ; AND( DateTable[Date] =< Today();DateTable[Date] > Today() - 15 ) ; " Last 2 Weeks" ; ........etc..
then either you create more periods or leave the date filters..to finish the formula..
After you add this column as filter and select by default the "Last 2 Weeks"..Everytime it refreshes the filter will contains the latest 14 days..
2. or with disconnected slicers...a simplified version of http://www.powerpivotpro.com/2013/06/simplifying-time-calculations-and-the-user-experience-using-disconnected-slicers/
- mebab10 years agoMicrosoft Employee
Hi, thank you for the replies.
My issue is that, I want the report to be run and ready for the up-to-date data but when the user opens it, the filters should contain a default value of start and end dates specifying last two weeks. But the user gets the privilege to change the date filter to any past date and that way the report gets updated with the new datetime values chosen.
Is there any way to support this?
- Greg_Deckler10 years agoCommunity Champion
Had a thought on this, alas it did not work. Created two measures, TODAY() and TODAY()-14 as their formulas. That's great, but you cannot set the filters to a measure value apparently. Thought was that you could go to Advanced Filtering and set "is on or after" the second measure and "is on or before" first measure.
No dice.
- konstantinos10 years agoMemorable Member
Where do you want the date filters to be selected from user..You cannot actually refresh the data based on the selection afterwards since all data are loaded and cached ( except live data sources)..There are 2 options or as a slicer or in the filters pane..
If you need to slicers/filters, one with start date and one with two dates like ( from excel but cann do the same in PowerBI Desktop - not in browser )..let me know and I will explain more..
- mebab10 years agoMicrosoft Employee
konstantinos, could you please elaborate? I couldn't properly understand the solution you gave.
Thanks!