Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
DAY | PERSON | Good |
1 | Person 1 | Apples |
1 | Person 2 | Apples |
2 | Person 3 | Apples |
2 | Person 4 | Apples |
Table 2
DAY | PERSON | Goods |
1 | John | Apples |
1 | Sarah | Cereal |
1 | Michael | Bananas |
2 | John | Pork |
Solved! Go to 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.
Hi,
Why does the Person column of the two Tables not match.
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.
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)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |