Forum Discussion
Filtering Matrix values
- 1 year ago
Hi M-Sayeed -Yes, it is possible to create a slicer in Power BI that allows you to toggle between two measures, such as export dollar values and volumes in tonnes, and display only one in your matrix.
You can do this by creating a "Measure Selector" with a disconnected table and some DAX logic.
Create a new table with the names of the two options you'd like to toggle between (e.g., "Dollar Values" and "Tonnes").
You could name this table something like Measure Selector.Go to Modeling > New Measure and create a measure that uses SWITCH and SELECTEDVALUE to toggle between the dollar values and tonnes
Selected Measure =
SWITCH(
SELECTEDVALUE('Measure Selector'[Measure]),
"Dollar Values", SUM('ExportData'[Dollar Values]),
"Tonnes", SUM('ExportData'[Tonnes])
)
Drag the Measure field from the Measure Selector table to the slicer.This will allow users to toggle between "Dollar Values" and "Tonnes".hope this helps
- Anonymous1 year ago
Hi, M-Sayeed
Based on your information, I create a sample table:
Then create a new table:
SlicerTable = DATATABLE( "Option", STRING, { {"Dollar Values"}, {"Volumes"} } )Create a new measure, and put the Option column in slicer view. Put measure in matrix visual:
SelectedValue = SWITCH( SELECTEDVALUE('SlicerTable'[Option]), "Dollar Values", SUM('Table'[DollarValue]), "Volumes", SUM('Table'[Volume (Tonnes)]) )Here is my preview:
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, M-Sayeed
Based on your information, I create a sample table:
Then create a new table:
SlicerTable = DATATABLE(
"Option", STRING,
{
{"Dollar Values"},
{"Volumes"}
}
)
Create a new measure, and put the Option column in slicer view. Put measure in matrix visual:
SelectedValue =
SWITCH(
SELECTEDVALUE('SlicerTable'[Option]),
"Dollar Values", SUM('Table'[DollarValue]),
"Volumes", SUM('Table'[Volume (Tonnes)])
)
Here is my preview:
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
It worked for me perfectly. Thanks a lot, mate.