Forum Discussion
Toggle data values in a slicer
- 1 year ago
Hi DioLago79
The most direct method to switch the column used on a slicer would be to create a field parameter containing the two possible columns, along with a slicer to select the field parameter value itself.
https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters
Depending on the model and the nature of the visuals, you could also use a calculation group approach:
https://www.sqlbi.com/articles/using-calculation-groups-to-switch-between-dates/
With this approach, the slicer would use a column from the date table, say
'Date'[Date], but changing the calculation item selection would change the relationship applied when evaluating measures.Would either of these methods work for you?
Hi DioLago79
You can use field parameters to switch between different columns, but when used in a slicer, the selection isn't retained during switching. If the dataset isn't too large and involves only a single query, consider adding an index column to that query. Then reference it, remove unnecessary columns, and keep only the index and date columns. Unpivot the remaining columns based on the index. After that, create a many-to-many single-direction relationship from the index column in the unpivoted table to the index column in the fact table.
Please see the attached sample pbix.