Forum Discussion
Filter a column based on another column result in same table
Hi,
I look around but didn't find any solution for this case, hope someone can help.
I have 2 tables
Table A
| Equipement | Parent | Code |
| GSC0B | 107428 | 107501 |
| GSC0V | 107428 | 107500 |
| GSC7S | 107503 | 107504 |
| GSCA3 | 107508 | 107506 |
| GSCAE | 107499 | 107498 |
| GSCBD | 107509 | 105921 |
| GSCC6 | 107511 | 107510 |
| GSCFV | 107502 | 107503 |
| GSCIP | 107505 | 107508 |
| GSCJ5 | 107507 | 107499 |
| GSCJW | 107428 | 107509 |
| GSCL2 | 107428 | 107511 |
| GSCNZ | 107501 | 107502 |
| GSCSF | 107501 | 107505 |
| GSCZG | 107501 | 107507 |
| GSCZY | 107428 | 107497 |
| GSC1T | 107427 | 340979 |
| GSC7T | 107501 | 107516 |
| GSCAH | 107500 | 107522 |
| GSCBG | 107504 | 107520 |
| GSCCD | 107506 | 107523 |
| GSCEQ | 107498 | 107524 |
| GSCGX | 105921 | 107517 |
| GSCHI | 107510 | 107526 |
| GSCJN | 107427 | 107515 |
| GSCM9 | 107427 | 107514 |
| GSCNF | 107427 | 107513 |
| GSCRU | 107427 | 107512 |
| GSCV0 | 107519 | 107521 |
| GSCVV | 107525 | 107519 |
| GSCXV | 107518 | 107525 |
| GSCZT | 107427 | 107518 |
Table B
| Equipement |
| GSC0B |
| GSC0V |
| GSC7S |
| GSCA3 |
| GSCAE |
| GSCBD |
| GSCC6 |
| GSCFV |
| GSCIP |
| GSCJ5 |
| GSCJW |
| GSCL2 |
| GSCNZ |
| GSCSF |
| GSCZG |
| GSCZY |
| GSC1T |
| GSC7T |
| GSCAH |
| GSCBG |
| GSCCD |
| GSCEQ |
There is a slicer with the name of Equipment (Table B)
When a Equipment selected, here for example: Equipment: GSC0B in table A, the code is 107501, then I use this code to search in column Parent, the result is below :
| Nom_Equipement | Parent | Code_Barre |
| GSCNZ | 107501 | 107502 |
| GSCSF | 107501 | 107505 |
| GSCZG | 107501 | 107507 |
| GSC7T | 107501 | 107516 |
Could you please advise how I could filter the table as above ?
Thank you in advance for any suggestion.
Tg
Hi Anonymous ,
Please try to apply this measure to the table visual's filter:
Flag = var _a = ALLSELECTED('Table B'[Equipement]) var _b = SELECTCOLUMNS(FILTER(ALL('Table A'),[Equipement] in _a),"Code",[Code]) return IF(SELECTEDVALUE('Table A'[Parent]) in _b,1)Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- v-jianboli-msftCommunity Support
Hi Anonymous ,
Please try to apply this measure to the table visual's filter:
Flag = var _a = ALLSELECTED('Table B'[Equipement]) var _b = SELECTCOLUMNS(FILTER(ALL('Table A'),[Equipement] in _a),"Code",[Code]) return IF(SELECTEDVALUE('Table A'[Parent]) in _b,1)Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Thank you v-jianboli-msft for the solution, It works perfectly if I don't have any relation between 2 tables.
For some other views , I need a relation between 2 tables as below :
Could you please advise if it's possible to resolve this without removing the relation ?
Many thanks in advance.
Tg
- v-jianboli-msftCommunity Support
Hi Anonymous ,
If you have relationship between these two tables, the slicer Equipement will filter the table visual directly.
Maybe you need to create a new table for the slicer.
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.