Suppose we have 3 tables, Table A, Table B, and Table C related to each other as
Table A (n-1) Table B (n-1) Table C i.e.
Table A has a lookup of Table B and Table B has a lookup of Table C.
Below is our sample canvas app that has a gallery and a combo box.
What we would want is based on the Table C record’s name selected in the combo box, we want to filter the collection to only show those records that are related to it.
One of the ways we could implement this is by using the AddColumns to add Table C data to Table A and apply the Filter to it.
Below is the formula to achieve the same.
In Table A, add a column name “TableCName”.
To get the Table C name, perform a Lookup on Table B, where Table B GUID is equal to Table A’s Table B lookup field, and then fetch the Table C Lookup’s name from Table B.
And lastly, perform a Filter on this new column TableCName, based on the selected value in the combo box.
See it working –
On selecting Table C1 in the combo box –
Similarly on selecting Table C2 in the combo box
Thanks to Debajit for guiding – https://debajmecrm.com/how-to-use-addcolumns-with-lookup-fields-of-sharepoint-in-power-apps/
To read more on AddColumns, Filter, and Lookup.
Hope it helps..
Product Table has Village Lookup in it and Village table has Region lookup in this sample screenshot
2 thoughts on “How to – Filter Collection / Items in Gallery based on the related (Lookup) record’s value – Power Apps / Canvas Apps (Dataverse/Dynamics 365)”