Forum Discussion
Cross filtering across tables
- 5 years ago
Hi pbhat89 ,
Do you want the result is the measure or the table?
If the measure is your result, please refer the following steps.
1. Change the Both direction to Single.
2. Then create a measure like this,
Measure = var _selected = SELECTEDVALUE('Table 2'[Condition]) var _select_count = CALCULATE(COUNT('Table 1'[ID]),FILTER('Table 2','Table 2'[Condition]=_selected)) var _Total = COUNT('Table 1'[ID]) return _Total - _select_countIf you have any question, please kindly ask here and we will try to resolve it.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.
Hi pbhat89 ,
If you have to use the Table 1[ID], maybe you can try to change the relationship direction to Both.
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.
- pbhat895 years ago
Helper II
I understand the example given by me may not be really representative. So updating the example and sharing expected output of the table and a measure.
TABLE 1
Each row shows 1 ID only. ID does not repeat in TABLE 1
Measure : Count_of_unique_ID = 8
TABLE 2
Each row is a unique combination of ID and Condition. i.e. ID,condition won't repeat. The table may have <= IDs from table 1. E.g. it will not have a new ID 10 which has not occured in table 1.
The current join is in BOTH direction and via ID
FILTERS & MEASURE - EXPECTED OUTPUT.
FILTER 1 = AGE < 35
FILTER 2 = EXCLUDE (not filter on) IDs with CONDITION (A)
TABLE 1 after filters
Measure : Count_of_unique_ID = 4
Right now the filter 2 above - filters on i.e. selects the IDs where A happened where as i want to remove the IDs where A happened. and then update the measure Count_of_unique_ID
Hope the query is clear now?
- v-zhenbw-msft5 years ago
Community Support
Hi pbhat89 ,
Do you want the result is the measure or the table?
If the measure is your result, please refer the following steps.
1. Change the Both direction to Single.
2. Then create a measure like this,
Measure = var _selected = SELECTEDVALUE('Table 2'[Condition]) var _select_count = CALCULATE(COUNT('Table 1'[ID]),FILTER('Table 2','Table 2'[Condition]=_selected)) var _Total = COUNT('Table 1'[ID]) return _Total - _select_countIf you have any question, please kindly ask here and we will try to resolve it.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.
- pbhat895 years ago
Helper II
In the above -
solution works but only for one condition. If i select two conditions i.e. A and B . then it doesn't work and reverts to the old count.