Forum Discussion
slicer to select background tables
Yes, it's possible to create a slicer in Power BI where you can select which table to use in other visuals. This can be achieved using a disconnected slicer or a table slicer with dynamic table selections.
Here's how you can do it using a disconnected slicer:
1. **Create a New Table**: Create a new table in Power BI Desktop with a list of tables that you want to compare. You can manually enter the table names or load them dynamically using DAX.
2. **Create a Slicer**: Insert a slicer visual onto your report canvas and connect it to the new table you created in step 1. This slicer will act as your selector for choosing the table.
3. **Use Selected Table in Other Visuals**: In other visuals where you want to use the selected table, use DAX measures or calculated columns to dynamically reference the selected table based on the slicer selection.
Here's an example of how you can use a DAX measure to dynamically reference the selected table:
```DAX
SelectedTableData =
SWITCH (
SELECTEDVALUE('TableSelector'[TableName]),
"Table1", SUM('Table1'[Value]),
"Table2", SUM('Table2'[Value]),
// Add additional cases for each table you want to compare
BLANK()
)
```
In this example, 'TableSelector' is the name of the table containing the list of tables, and 'TableName' is the column containing the table names. You can replace "Table1", "Table2", etc., with the actual table names in your dataset.
By selecting a table in the disconnected slicer, the other visuals will dynamically adjust their data based on the selected table.
Using a disconnected slicer allows you to compare different tables without loading all the data into the dataset. However, keep in mind that this approach works well for comparing a few tables, but it may become less practical with a large number of tables or if the tables have significantly different structures.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
for this i need to load all the Tables to the Model right?
Is it possible to select the table and then a query runs and loads the data to the model?