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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
mlbo
Regular Visitor

DAX to filter on rows and columns with values

I have a data set requiring a matrix visual. I want to create a slicer where if i filter on a column, for example "A" i want to see all rows where there is data in "A", but also see the corresponding columns if they contain a value. 

 

E.g. if this is my starting point:

        A     B      C

J1            10  -10

J2    20   -20   

J3    12  -12

 

When i filter on "A" in the slicer, this is how I want it to look:

        A     B     

J2    20   -20   

J3    12  -12

 

If i filter on "C" in the slicer, then it should show this:

      B      C

J1  10  -10

 

Is there a way to do this? I have tried googling but I havent been able to find anything

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @mlbo ,

 

Based on your description, I created these data.

vkaiyuemsft_0-1720056927842.png

 

1. created the calculation table and used the fields in the calculation table as slicers.

Table 2 = 
DISTINCT('Table'[Column2])


2. create the MEASURE.

Measure = 
VAR _value = CALCULATE(MAX('Table'[Column3]),FILTER(ALL('Table'),'Table'[Column1] = MAX('Table'[Column1]) && 'Table'[Column2] = SELECTEDVALUE('Table 2'[Column2])))
RETURN
IF(_value = BLANK(),0,1)

 

3.Use the value of MEASURE equal to 1 as a filter for the matrix.

vkaiyuemsft_1-1720056986842.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

2 REPLIES 2
mlbo
Regular Visitor

Thank you, that worked!

Anonymous
Not applicable

Hi @mlbo ,

 

Based on your description, I created these data.

vkaiyuemsft_0-1720056927842.png

 

1. created the calculation table and used the fields in the calculation table as slicers.

Table 2 = 
DISTINCT('Table'[Column2])


2. create the MEASURE.

Measure = 
VAR _value = CALCULATE(MAX('Table'[Column3]),FILTER(ALL('Table'),'Table'[Column1] = MAX('Table'[Column1]) && 'Table'[Column2] = SELECTEDVALUE('Table 2'[Column2])))
RETURN
IF(_value = BLANK(),0,1)

 

3.Use the value of MEASURE equal to 1 as a filter for the matrix.

vkaiyuemsft_1-1720056986842.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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