Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I am trying to make a drop-down slicer in a report in PowerBi that will contain the columns of a table as parameters. More specifically, when the user chooses one value, then the data of the chosen column will show on the map. However, the table's type of data (Measures) cannot be input in the "Field" of the drop-down slicer. Anyone knows an alternative to input that type of data in the slicer?
Solved! Go to Solution.
@user365576 , consider field parameters
Power BI Field Parameters — A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...
Power BI Field Parameters- Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f
Field Parameters- Conditional Formatting
: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf
Power BI Field Parameters, Keep Axis Sort intact| Always Sort on X/Categorial Axis: https://youtu.be/GfBrB6czByw
Hi @user365576 ,
@amitchandak ,good answer! That's one possible solution.
And you can try this way:
Create a new disconnected table by using DAX:
ColumnSelection = DATATABLE("ColumnName", STRING, {{"Column1"}, {"Column2"}, {"Column3"}})
which creates a table with a single column named 'ColumnName' and rows for each column you want to be selectable.
Then use DAX to create a new measure to switch columns dynamically:
DynamicMeasure =
VAR SelectedColumn = SELECTEDVALUE(ColumnSelection[ColumnName], "DefaultColumn")
RETURN
SWITCH(
SelectedColumn,
"Column1", SUM(Table[Column1]),
"Column2", SUM(Table[Column2]),
"Column3", SUM(Table[Column3]),
SUM(Table[DefaultColumn]) // Default case if no selection is made
)
Replace 'Table[Column1]', 'Table[Column2]', etc., with the actual column references from your data model.
Add the 'ColumnName' field from the disconnected table to a slicer visual on your report and add the 'DynamicMeasure' you created to the map visual. This measure will change based on the slicer selection.
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @user365576 ,
@amitchandak ,good answer! That's one possible solution.
And you can try this way:
Create a new disconnected table by using DAX:
ColumnSelection = DATATABLE("ColumnName", STRING, {{"Column1"}, {"Column2"}, {"Column3"}})
which creates a table with a single column named 'ColumnName' and rows for each column you want to be selectable.
Then use DAX to create a new measure to switch columns dynamically:
DynamicMeasure =
VAR SelectedColumn = SELECTEDVALUE(ColumnSelection[ColumnName], "DefaultColumn")
RETURN
SWITCH(
SelectedColumn,
"Column1", SUM(Table[Column1]),
"Column2", SUM(Table[Column2]),
"Column3", SUM(Table[Column3]),
SUM(Table[DefaultColumn]) // Default case if no selection is made
)
Replace 'Table[Column1]', 'Table[Column2]', etc., with the actual column references from your data model.
Add the 'ColumnName' field from the disconnected table to a slicer visual on your report and add the 'DynamicMeasure' you created to the map visual. This measure will change based on the slicer selection.
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@user365576 , consider field parameters
Power BI Field Parameters — A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...
Power BI Field Parameters- Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f
Field Parameters- Conditional Formatting
: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf
Power BI Field Parameters, Keep Axis Sort intact| Always Sort on X/Categorial Axis: https://youtu.be/GfBrB6czByw
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
105 | |
79 | |
69 | |
62 |
User | Count |
---|---|
143 | |
104 | |
103 | |
82 | |
70 |