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
Moonc
Frequent Visitor

Are values from Table2 present in Table1 (with filters present on table 2)

I have two tables that are identical in my data model. The only difference is that Table2 is being filtered by the URL given for the report.

 

I need to be able to tell what values are present in Table2 in Table1.

 

Table 1 (Expected Result, actual result is passing all TRUE because [Present] is finding all values in both tables)

UserGroup1UserName1Present
ACTrue
ADFalse

 

Present = CALCULATE(COUNTROWS(TABLE2),FILTER(TABLE2,Table2[UserName2] = Table1[UserName1])) > 0

 

Table2 (this table actually contains both UserName C and D, but its just filtered via the URL passed for this user)

UserGroup2UserName2
AC

 

I have tried putting ALLSELECTED() around table2 in the filter, but I think I am misunderstanding how that function works.

1 ACCEPTED SOLUTION

@FreemanZ - They are dataset tables.

 

I was able to solve my problem by shifting my approach and using a measure.

 

=COUNTROWS(FILTER(TABLE1,NOT(CONTAINS(TABLE2,TABLE2[UserName2],TABLE1[UserName1]))))

 

When the user is filtering table1 (through a slicer), the count will be (blank) until the only value(s) selected are currently present in Table2.

 

I am then using this count to dynamically change measures across the pages. Very niche use case, but I got it to work.

View solution in original post

5 REPLIES 5
Moonc
Frequent Visitor

Side note, my formula works if I change the data in table2 to only have the values that I need. But in the real scenario, table2 will be filtered by the URL of the report.

hi @Moonc 

 

Are table1 and table2 dataset tables or visuals tables?

make some screenshot if you are not sure. 

@FreemanZ - They are dataset tables.

 

I was able to solve my problem by shifting my approach and using a measure.

 

=COUNTROWS(FILTER(TABLE1,NOT(CONTAINS(TABLE2,TABLE2[UserName2],TABLE1[UserName1]))))

 

When the user is filtering table1 (through a slicer), the count will be (blank) until the only value(s) selected are currently present in Table2.

 

I am then using this count to dynamically change measures across the pages. Very niche use case, but I got it to work.

Greg_Deckler
Community Champion
Community Champion

@Moonc Not sure I fully understand the actual data in the data model but you can use INTERSECT to determine which values are present in both tables.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Intersect has the same problem as my present calculate column has (it will compare ALL values of table1 to table 2). I need table2 to be passing ONLY values for what is currently filtered.The table itself has all of the same values that Table1 has, but it will be filtered by the URL of the report.

 

Edit: to clarify a bit

 

Table1 (Expected result, UserName1 = D is false because it is not selected in the filter)

UserGroup1UserName1Present
ACTrue
ADFalse

 

Table2 (Unfiltered)

UserGroup2UserName2
AC
AD

 

Table2 (filtered by slicer (hidden to user))

UserGroup2UserName2
AC

 

Table 2 is always going to filtered. Whenever I try to do comparisons between the two tables, it is comparing the unfiltered version. I need it to compare the filtered version

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.