Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
M-Sayeed
Regular Visitor

Filtering Matrix values

Hi

My matrix is showing a country's exports and it has calendar years in the columns and export products in the rows. I can use export dollar values and volumes (in tonnes) as the Matrix Values but want to use slicer which will allow me show either the dollar values or the tonnes but not the both. Is it possible to create such a slicer/filter?

2 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

Anonymous
Not applicable

Hi, @M-Sayeed 

Based on your information, I create a sample table:

vyohuamsft_0-1727082047587.png

 

Then create a new table:

SlicerTable = DATATABLE(
    "Option", STRING,
    {
        {"Dollar Values"},
        {"Volumes"}
    }
)

vyohuamsft_1-1727082085936.png

 

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:

vyohuamsft_2-1727082215777.png

vyohuamsft_3-1727082226811.png

 

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.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi, @M-Sayeed 

Based on your information, I create a sample table:

vyohuamsft_0-1727082047587.png

 

Then create a new table:

SlicerTable = DATATABLE(
    "Option", STRING,
    {
        {"Dollar Values"},
        {"Volumes"}
    }
)

vyohuamsft_1-1727082085936.png

 

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:

vyohuamsft_2-1727082215777.png

vyohuamsft_3-1727082226811.png

 

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 v-yohua-msft
Preview
Thanks a lot for your spot-on solution. It solved my problem very perfectly in the Power BI Desktop RS version. But the probem is when I upload it on Power BI server it is not accepting the report anymore. From discussions in this forum, posted by others ,I understood that Power BI server cannot handle DAX query view. In that case I cannot use New Table and New Measure functions. Now I can create a Table with an Option column where I have "Dollar Values" and "Volumes" rows from Excel to avoid using New Table function. Is there any way I can create your SelectedValue measure in excel which I then can be imported into PowerBI report? Thanks.
 
 

It worked for me perfectly. Thanks a lot, mate. 

rajendraongole1
Super User
Super User

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Very helpful. Thanks a lot, mate. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.