Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello
I have a Table1 visual with Col1 and Col2 below:
A, A1
B, B1
etc
The A1, B1 values are common with Col1 of another Table2 and I used that column to join the two tables.
The A, B values exist in a Col2 of the Table2 as well, but in the form of:
A | B | C
B | C
A
A | B
etc
I.e. the A, B values appear in the Table2 but they can be part of a larger string joined with "|".
My goal is to create a count measure that will count the rows in Table2 with the following matches:
1) the count will match the common values A1, B1 etc in Table2
2) the count will match the non-directly-common (as they are in a string joined with "|") values A, B, in a way that if e.g. A is contained in the "|" joined string, it should be matched.
How can I do that?
Thanks!
Solved! Go to Solution.
Hi @Anonymous ,
Please check:
Create measures like so:
Count 1 =
VAR t =
ADDCOLUMNS (
Table2,
"Col2_", LOOKUPVALUE ( Table1[Col1], Table1[Col1], Table2[Col2] )
)
RETURN
IF (
HASONEVALUE ( Table1[Col1] ),
COUNTROWS (
FILTER ( t, [Col2_] <> BLANK () && [Col2_] = MAX ( Table1[Col1] ) )
) + 0,
COUNTROWS ( FILTER ( t, [Col2_] <> BLANK () ) ) + 0
)
Count 2 =
VAR t =
ADDCOLUMNS (
Table2,
"Col2_", IF (
SEARCH ( MAX ( Table1[Col1] ), Table2[Col2],, 0 ) <> 0
&& SEARCH ( "|", Table2[Col2],, 0 ) <> 0,
MAX ( Table1[Col1] )
)
)
RETURN
IF (
HASONEVALUE ( Table1[Col1] ),
COUNTROWS (
FILTER ( t, [Col2_] <> BLANK () && [Col2_] = MAX ( Table1[Col1] ) )
) + 0,
COUNTROWS ( FILTER ( t, [Col2_] <> BLANK () ) ) + 0
)
If my understanding is not correct, please let me know.
BTW, .pbix file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Please check:
Create measures like so:
Count 1 =
VAR t =
ADDCOLUMNS (
Table2,
"Col2_", LOOKUPVALUE ( Table1[Col1], Table1[Col1], Table2[Col2] )
)
RETURN
IF (
HASONEVALUE ( Table1[Col1] ),
COUNTROWS (
FILTER ( t, [Col2_] <> BLANK () && [Col2_] = MAX ( Table1[Col1] ) )
) + 0,
COUNTROWS ( FILTER ( t, [Col2_] <> BLANK () ) ) + 0
)
Count 2 =
VAR t =
ADDCOLUMNS (
Table2,
"Col2_", IF (
SEARCH ( MAX ( Table1[Col1] ), Table2[Col2],, 0 ) <> 0
&& SEARCH ( "|", Table2[Col2],, 0 ) <> 0,
MAX ( Table1[Col1] )
)
)
RETURN
IF (
HASONEVALUE ( Table1[Col1] ),
COUNTROWS (
FILTER ( t, [Col2_] <> BLANK () && [Col2_] = MAX ( Table1[Col1] ) )
) + 0,
COUNTROWS ( FILTER ( t, [Col2_] <> BLANK () ) ) + 0
)
If my understanding is not correct, please let me know.
BTW, .pbix file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , one of the way is to split the column into rows
refer
https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/
You can use the SEARCH function to look for a string inside a string.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.