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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
FabvE
Helper I
Helper I

Count rows containing string from other table column

Hi,

I already tried some solutions ( like CountRows where column A contains a string and col... - Microsoft Fabric Community or Solved: Count rows containing value - Microsoft Fabric Community ) but that didn't help me.

My report has (in short) two tables:

 

Table 1: OwnerUnique

Columns:

  • owner_mail: contains a single mail address per row as string

 

Table2: final_output

Columns:

  • owner_final: contains a string with multiple mail adresses separated by comma
  • virtual_path: an url as string

 

What do I need/want:

In a table visual I want to

  • list all OwnerUnique[owner_mail]
  • count all rows in table final_output where column [owner_final] contains the value from OwnerUnique[owner_mail]

At the moment the visual only counts these rows where the mail address is the only value but rows with multiple addresses are aggregated into a blank value in the visual.

FabvE_0-1733907554943.png

 

My measure looks like this:

Kennzahl = CALCULATE(
COUNT(
final_output
[VirtualPath_final]),
FILTER(final_output, CONTAINSSTRING(final_output[owner_final], SELECTEDVALUE(OwnerUnique[owner_mail]))
)
)

 

Do you have any hinbts or ideas how to solve it?

 

Best regards

2 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @FabvE -  we need to refine the DAX logic to correctly evaluate rows with multiple email addresses. 

Kennzahl =
CALCULATE(
COUNTROWS(final_output),
FILTER(
final_output,
CONTAINSSTRING(
SUBSTITUTE(final_output[owner_final], " ", ""),
SELECTEDVALUE(OwnerUnique[owner_mail])
)
)
)

 

Alternatively, use a calculated table in DAX to create a normalized version of final_output.

 

Hope this works.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

AnkitaaMishra
Super User
Super User

Hi @FabvE , Tried with sample data as below : 

WhatsApp Image 2024-12-11 at 14.46.10.jpeg


you can modify your dax as below : 
Measure =
CALCULATE(
COUNTROWS(final_output),
FILTER(
final_output,
NOT(ISBLANK(SELECTEDVALUE(OwnerUnique[owner_mail]))) &&
CONTAINSSTRING(final_output[owner_final], SELECTEDVALUE(OwnerUnique[owner_mail]))
)
)


Thanks, 
Ankita

View solution in original post

3 REPLIES 3
FabvE
Helper I
Helper I

Thank you both of you. Now it's working fine!

AnkitaaMishra
Super User
Super User

Hi @FabvE , Tried with sample data as below : 

WhatsApp Image 2024-12-11 at 14.46.10.jpeg


you can modify your dax as below : 
Measure =
CALCULATE(
COUNTROWS(final_output),
FILTER(
final_output,
NOT(ISBLANK(SELECTEDVALUE(OwnerUnique[owner_mail]))) &&
CONTAINSSTRING(final_output[owner_final], SELECTEDVALUE(OwnerUnique[owner_mail]))
)
)


Thanks, 
Ankita

rajendraongole1
Super User
Super User

Hi @FabvE -  we need to refine the DAX logic to correctly evaluate rows with multiple email addresses. 

Kennzahl =
CALCULATE(
COUNTROWS(final_output),
FILTER(
final_output,
CONTAINSSTRING(
SUBSTITUTE(final_output[owner_final], " ", ""),
SELECTEDVALUE(OwnerUnique[owner_mail])
)
)
)

 

Alternatively, use a calculated table in DAX to create a normalized version of final_output.

 

Hope this works.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors