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
Anonymous
Not applicable

Count of column values in Table 1 present in Table 2 column - Power BI

I have two tables

 

table 1

product_nameID
abc123
abc789

 

table 2

product_nameID
abc

789

 

report layout

monk_0-1608695781965.png

 

Filter table 2 ID values based on table 1 Id values

 

 

business qn: I want to know how many of them downloaded the trial product and out of those how many purchased. Left side trials, right side purchases. Table_1 is trial download data table_2 is purchase data

 

PS: columns are not unique

 

 

 

 

2 ACCEPTED SOLUTIONS
v-janeyg-msft
Community Support
Community Support

Hi, @Anonymous 

 

It’s my pleasure to answer for you.

According to your description,I think create two measure in card to calculate the desired result.

Like this:

 

count1 = COUNTROWS(Table1)

count2 = COUNTROWS(INTERSECT(Table2,Table1))

 

4.png

Here is my sample .pbix file.Hope it helps.

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

Hi, @Anonymous 

 

If there are more than two columns in the table.

You can try this:

count2 =
COUNTROWS (
    INTERSECT (
        SELECTCOLUMNS ( Table2, "name", [product_name], "id", [ID] ),
        SELECTCOLUMNS ( Table1, "name", [product_name], "id", [ID] )
    )
)

Best Regards

Janey Guo

 

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

4 REPLIES 4
v-janeyg-msft
Community Support
Community Support

Hi, @Anonymous 

 

It’s my pleasure to answer for you.

According to your description,I think create two measure in card to calculate the desired result.

Like this:

 

count1 = COUNTROWS(Table1)

count2 = COUNTROWS(INTERSECT(Table2,Table1))

 

4.png

Here is my sample .pbix file.Hope it helps.

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

Hi, @Anonymous 

 

If there are more than two columns in the table.

You can try this:

count2 =
COUNTROWS (
    INTERSECT (
        SELECTCOLUMNS ( Table2, "name", [product_name], "id", [ID] ),
        SELECTCOLUMNS ( Table1, "name", [product_name], "id", [ID] )
    )
)

Best Regards

Janey Guo

 

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

Anonymous
Not applicable

@v-janeyg-msft Thank you. !!

lbendlin
Super User
Super User

For maximum flexibility you'll want to let the data model do the work for you. Meaning you would need to define some sort of relationship between the tables, and then decide on the filter direction (which table impacts the other). This works ok-ish even if the values are not unique in the "dimension"  table but it would works better if you had a Products reference table that has unique values.

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.