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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
EMSSS22
Helper I
Helper I

If value equals X then display rows a, b and c in matrix visual else

Someone please help me!

 

I have to show data in a matrix depending on a value in another column.

 

If value = x - I need to show rows MPC Current, MPC Budget, MPC Variance, NCR Current, NCR Budget, NCR Variance

else 

If value = y - I need to show all other rows

 

EMSSS22_0-1667422928728.png

Am I going about this the wrong way? How do I do this?

 

 

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

Hi, @EMSSS22 

You can add a custom filter measure and drag it to visual filter pane to filter data.

filter =
SWITCH (
    SELECTEDVALUE ( Slicer[Value] ),
    "x",
        IF (
            SELECTEDVALUE ( Sheet1[row] )
                IN {
                "MPC Current",
                "MPC Budget",
                "MPC Variance",
                "NCR Current",
                "NCR Budget",
                "NCR Variance"
            },
            1,
            0
        ),
    "y",
        IF (
            NOT SELECTEDVALUE ( Sheet1[row] )
                IN {
                "MPC Current",
                "MPC Budget",
                "MPC Variance",
                "NCR Current",
                "NCR Budget",
                "NCR Variance"
            },
            1,
            0
        ),
    1
)

  

veasonfmsft_0-1667461335808.png

Please check my attached pbix for more details.

Best Regards,
Community Support Team _ Eason

View solution in original post

4 REPLIES 4
v-easonf-msft
Community Support
Community Support

Hi, @EMSSS22 

You can add a custom filter measure and drag it to visual filter pane to filter data.

filter =
SWITCH (
    SELECTEDVALUE ( Slicer[Value] ),
    "x",
        IF (
            SELECTEDVALUE ( Sheet1[row] )
                IN {
                "MPC Current",
                "MPC Budget",
                "MPC Variance",
                "NCR Current",
                "NCR Budget",
                "NCR Variance"
            },
            1,
            0
        ),
    "y",
        IF (
            NOT SELECTEDVALUE ( Sheet1[row] )
                IN {
                "MPC Current",
                "MPC Budget",
                "MPC Variance",
                "NCR Current",
                "NCR Budget",
                "NCR Variance"
            },
            1,
            0
        ),
    1
)

  

veasonfmsft_0-1667461335808.png

Please check my attached pbix for more details.

Best Regards,
Community Support Team _ Eason

Thats great thank you.

 

Is there a way of making the slicer automatically detect whether it's 0 or 1 based off another field? rather then manually having to select the right number?

 

Look forward to hearing back and thanks for all the help!

Hi, @EMSSS22 

If I understand correctly, you don't want to use slicers to control data filtering. If so, please delete the slicer and

replace 'SELECTEDVALUE(Slicer[Value])' with 'SELECTEDVALUE(Table[Another field])' in the original formula.

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@EMSSS22 , if these are row values, you can control them using measures. 

 

Switch(selectedvalues(Value[Value]),

"X", calculate([Measure], filter(Table, Table[Metric] in {" MPC Current", "MPC Budget", "MPC Variance"}) ,

[Measure]

)

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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