Forum Discussion
Clearing a slicer value
- 6 years ago
Hi Anonymous ,
maybe this helps to create a default filter element, what is always valid.
Hi Anonymous ,
take a look at this.
https://powerbi.microsoft.com/en-us/blog/announcing-persistent-filters-in-the-service/
- Anonymous6 years agoNot applicable
Thanks for that, however doing the 'reset' would just return the slicer to a prior value. Single select slicers cannot (I don't think) start in an unselected state.
The issue I have is that the selected value is no longer valid for that page so I don't know why it persists. In the below graphic, I picked a week when I didn't have relative filtering set up. Then I put a relative filter of prior 6 calendar weeks, then expanded the slicer. The moment I click off the Feb 22 entry, it drops off the list.
I'm just trying to figure out how to no longer have it selected when the user goes back to the page without them having to do anything. If I could start out with nothing selected then the "reset to default" would work; however, it is a destructive operation. It clears all of the filters on all of the pages back to the default, and that is a bad practice as the user may want to have their report remain filtered to a specific department.
- edhans6 years agoCommunity Champion
Another "gotcha" from Relative filtering.
Here is what I would suggest trying.
- Add a True/False field in your date table in Power Query like
= Duration.Days(DateTime.Date(DateTime.LocalNow()) - [Date]) <= 7 and Duration.Days(DateTime.Date(DateTime.LocalNow()) - [Date]) > 0- Filter your slicer on that field to only show TRUE values.
If your date table was built in DAX, you'd just need similar logic to get the true/false value.
In general, try to avoid calculated columns. There are times to use them, but it is rare. Getting data out of the source system, creating columns in Power Query, or DAX Measures are usually preferred to calculated columns. See these references:
Calculated Columns vs Measures in DAX
Calculated Columns and Measures in DAX
Storage differences between calculated columns and calculated tables
Creating a Dynamic Date Table in Power Query- Anonymous6 years agoNot applicable
It sounds like there isn't a solution to this problem. I don't have a date table anywhere in the model as different report pages pull from different tables. The different tables either are daily or week ending and as such, there isn't a consolidated date table.
Calculated columns are not an option on a live connection for us either.
Finally, I created a table with 4 columns, the end of week date, a number, a flag for Prior week where it was a true/false value if the end of the week was last week. To simulate this scenario of someone looking at it last week and then looking at it this week. So I selected, week ending 23 May 2020 for when they looked at it last week. Then I filtered the slicer on the flag where it was true. I still had 23 May 2020 in the selection list and it was the selected value. When I selected 30 May 2020, 23 May went away.
It looks like it's a 'by design' thing with slicers that if the values in the slicer are no longer valid then it still stays selected. I've noticed this in the past where I have a slicer which only displays the weeks where a widget was sold. In the case where I looked for widget A, I could get 1/1/2020, 1/8/2020, 1/15/20, and select 1/8/2020. When I select widget B, and it only sold on the week ending 1/15/2020, 1/8/2020 is still selected in the filter, but it's not a valid date as evidenced when I clear the selection.
I'll mark your last reply as a solution unless Microsoft as a better answer, I'll just consider it another limitation in the tool - I mean seriously how hard is it to add a property to the card visualization so when it would return (blank) you could have it put something else in without you having to write a measure and take additional cycle time.
Thanks again.
- mwegener6 years agoMost Valuable Professional
Hi Anonymous ,
maybe this helps to create a default filter element, what is always valid.