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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
skowronp
Frequent Visitor

Filtering row header and column header for matrix visual

Hi All,

 

I have a problem with context filtering. I have to calculate measure (direct query mode) for the matrix visual purposes. What I want to achieve is to dynamically compare row and column headers (from different dimensions) and if they are equal put 0. Any ideas ?

 

CALCULATE(something; FILTER(DimensionA[columnA];CONTAINS(DimensionA;DimensionA[columnA];DimensionB[columnB])=true());

 

As result I want to have something like this:
       A     B     C     D
A     0    1     1     1
B     1     0     1     1
C     1     1     0     1
D     1     1     1     0

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@skowronp

 

This measure is sliced by both DimensionA[columnA] and DimensionB[columnB]. It will not detect if current slicing member has same name.

 

Is there relationship between DimensionA[columnA] and DimensionB[columnB]? If not, you must have a table with both colums cross join. 

 

24.PNG

 

Then create a measure like below: 

 

 = IF(MAX('Table'[ColumnA])=MAX('Table'[ColumnB]),0,1)

66.PNG

 

Regards,

 

 

View solution in original post

1 REPLY 1
v-sihou-msft
Employee
Employee

@skowronp

 

This measure is sliced by both DimensionA[columnA] and DimensionB[columnB]. It will not detect if current slicing member has same name.

 

Is there relationship between DimensionA[columnA] and DimensionB[columnB]? If not, you must have a table with both colums cross join. 

 

24.PNG

 

Then create a measure like below: 

 

 = IF(MAX('Table'[ColumnA])=MAX('Table'[ColumnB]),0,1)

66.PNG

 

Regards,

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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