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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
ppatil
Helper III
Helper III

DAX to switch from one measure to another in the Matrix

Hi Community..!!
I want to write a DAX to switch between one measure to another in the Matrix Visual.

Please refere the below image.

Slicer

ppatil_1-1652424846515.png

Matrix Visual

ppatil_2-1652424890863.png

When I select Average in the slicer then it should show only Average in the Matrix , When I select Number in the slicer then it should show only Number in the Matrix and When I select Select all option in the slicer then it should show both Average and Number  in the Matrix.
Could u please help me to do that? 

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @ppatil ,

According to your description, I create a sample, only the values can be filtered by the slicer but the title can't.

Here's my solution.

Average =
IF (
    SELECTEDVALUE ( Slicer[Slicer] ) IN { "Average", "Select-all" },
    AVERAGE ( 'Table'[Sales] ),
    BLANK ()
)
Number =
IF (
    SELECTEDVALUE ( Slicer[Slicer] ) IN { "Number", "Select-all" },
    COUNT ( 'Table'[Sales] ),
    BLANK ()
)

 Get the result.

vkalyjmsft_0-1652946406369.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

3 REPLIES 3
v-yanjiang-msft
Community Support
Community Support

Hi @ppatil ,

According to your description, I create a sample, only the values can be filtered by the slicer but the title can't.

Here's my solution.

Average =
IF (
    SELECTEDVALUE ( Slicer[Slicer] ) IN { "Average", "Select-all" },
    AVERAGE ( 'Table'[Sales] ),
    BLANK ()
)
Number =
IF (
    SELECTEDVALUE ( Slicer[Slicer] ) IN { "Number", "Select-all" },
    COUNT ( 'Table'[Sales] ),
    BLANK ()
)

 Get the result.

vkalyjmsft_0-1652946406369.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank U @v-yanjiang-msft 

Arul
Super User
Super User

@ppatil ,

Calculation groups should help you for this scenario. You can try to create calculation groups for your scenarion by following the steps mentioned in the following blog post.

https://data-mozart.com/mastering-dp-500-exam-creating-calculation-groups/ 

 

Thanks,

Arul





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

Proud to be a Super User!


LinkedIn


Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.