0
votes

I have two tables in which I created a relationship on the ID from table 1 to table 2.

I have a slicer(check boxes) that takes the countries from Table 1 which looks as follows

US
Brazil
Canada
Mexico
Peru

Table 2 looks as follows

ID   | Countries
1111 | Mexico
1111 | US
1111 |Brazil
1111 |Mexico
1111 |Peru
1111 |US
1111 |US
1215 |US
1215 |Brazil

Currently I have a measure as follows

M_Answer = Count('Table 2'[ID])+0 

This gives me a total of my IDS which is 7 as you can see from above for ID 1111.

My question is if I have to select "Mexico" from my slicer

Slicer from table 1

how do I create a measure that would take in my slicer selection and calculate the number of ID's based on that country selection. so for example I would have the count of 2 for mexico, if US is selected I would show the count of 3, if nothing is selected than I can just show the total count of 7

1

1 Answers

0
votes

As you said, you used ID column to create a relationship between both tables but ID column from table 2 have the same id values for all your countries which makes no sense and thats the problem.

What you have to do is create a relationship between both tables using the Country column: enter image description here

That way you can get the expected result using your dax measure.

enter image description here