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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Getting attach rates - Division of 2 counts from 2 different tables

Hi, I'm new to Power BI. I have 2 tables.

 

Table 1 shows number of people entering a supermarket, who bought apples.

Table 2 shows number of people who entered the supermarket. They could have bought anything.

 

What I want is to take Table 1, on a daily basis, take the number of people (count) who were in Table 1, and divide that count by the number of people (another count) who went to the supermarket from Table 2.

 

What I want is to see out of the number of people who went to the supermarket, what percentage bought apples, and have that percentage split by date.

 

Table 1

DAYPERSONGood
1Person 1Apples
1Person 2Apples
2Person 3Apples
2Person 4

Apples

 

Table 2

DAYPERSONGoods
1JohnApples
1SarahCereal
1MichaelBananas
2JohnPork
1 ACCEPTED SOLUTION

Hi,

Create a Table with 2 entries - 1 and 2.  Build a relationship from the Day column of both your Tables to the Day column of this new Table.  In your visual, drag the Day column from this new Table.  Write these measures

People buying apples = CALCULATE(COUNTROWS(Table1),Table1[Good]="Apples")

People visiting = COUNTROWS(Table2)

% of people buying apples = [People buying apples]/[People visiting]

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Why does the Person column of the two Tables not match.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

That's because I wanted to put emphasis on the person's names not matching. I want the number of people who bought apples divided by the number of people who entered the store on Day 1 or Day 7 etc.


@Ashish_Mathur wrote:

Hi,

Why does the Person column of the two Tables not match.


 

Hi,

Create a Table with 2 entries - 1 and 2.  Build a relationship from the Day column of both your Tables to the Day column of this new Table.  In your visual, drag the Day column from this new Table.  Write these measures

People buying apples = CALCULATE(COUNTROWS(Table1),Table1[Good]="Apples")

People visiting = COUNTROWS(Table2)

% of people buying apples = [People buying apples]/[People visiting]

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Should the relationship be Many to Many? Also, should cross filter direction be both or single direction?

Also can I write what you did as one measure, with the division taking place in it?


@Ashish_Mathur wrote:

Hi,

Create a Table with 2 entries - 1 and 2.  Build a relationship from the Day column of both your Tables to the Day column of this new Table.  In your visual, drag the Day column from this new Table.  Write these measures

People buying apples = CALCULATE(COUNTROWS(Table1),Table1[Good]="Apples")

People visiting = COUNTROWS(Table2)

% of people buying apples = [People buying apples]/[People visiting]

Hope this helps.


 

Hi,

It should be Many to 1, Single.  Try this single measure

=CALCULATE(COUNTROWS(Table1),Table1[Good]="Apples")/COUNTROWS(Table2)


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors