Forum Discussion
Hi Experts, Need help in slicer
- 2 years ago
Hi Omesh
Slicers can't natively "reset" when their selection becomes invalid.
However, there is a workaround involving field parameters. I have attached a small example.
I have assumed Slicer 1 & Slicer 2 only allow single selection. This can be relaxed for Slicer 2 without changing anything, but if relaxed for Slicer 1 it complicates things.
The basic idea is:
- SlicerTable contains the original columns Slicer 1 & Slicer 2.
- Create a new 'Slicer 2' table that contains one column per distinct value of Slicer 1 (3 in this example). These columns are identical and each contains the distinct values of Slicer 2.
- Create a 'Slicer 2 Field Parameter' that allows selection of the 3 columns of 'Slicer 2', with a column corresponding to the values of Slicer 1.
- Create a bi-directional 1:many relationship from 'Slicer 2' to SlicerTable.
- On the report page:
- Slicer 1 slicer uses SlicerTable[Slicer 1]
- Slicer 2 slicer uses 'Slicer 2 Field Parameter'[Slicer 2 Parameter]
- There is a hidden slicer using 'Slicer 2 Field Parameter'[Slicer 1] that is synced with the main Slicer 1 slicer.
- Now, whenever the selection on Slicer 1 is changed, the Slicer 2 slicer will reset. If single-select is enabled, it will reset to the first available value.
Please take a look at attached PBIX and see if that helps 🙂
Regards
Hi Omesh
Slicers can't natively "reset" when their selection becomes invalid.
However, there is a workaround involving field parameters. I have attached a small example.
I have assumed Slicer 1 & Slicer 2 only allow single selection. This can be relaxed for Slicer 2 without changing anything, but if relaxed for Slicer 1 it complicates things.
The basic idea is:
- SlicerTable contains the original columns Slicer 1 & Slicer 2.
- Create a new 'Slicer 2' table that contains one column per distinct value of Slicer 1 (3 in this example). These columns are identical and each contains the distinct values of Slicer 2.
- Create a 'Slicer 2 Field Parameter' that allows selection of the 3 columns of 'Slicer 2', with a column corresponding to the values of Slicer 1.
- Create a bi-directional 1:many relationship from 'Slicer 2' to SlicerTable.
- On the report page:
- Slicer 1 slicer uses SlicerTable[Slicer 1]
- Slicer 2 slicer uses 'Slicer 2 Field Parameter'[Slicer 2 Parameter]
- There is a hidden slicer using 'Slicer 2 Field Parameter'[Slicer 1] that is synced with the main Slicer 1 slicer.
- Now, whenever the selection on Slicer 1 is changed, the Slicer 2 slicer will reset. If single-select is enabled, it will reset to the first available value.
Please take a look at attached PBIX and see if that helps 🙂
Regards