Hi,
I am new to PowerApps and trying to create a simple Canvas app but hit a wall. I am hoping if someone can help point me in the right direction.



As shown above, there are two Dataverse tables (Table1 and Table2). Table2 is a list of locations which is used as a lookup for the "Location" column in Table1.
I wanted to create a pie chart based on the number of times the list of locations are visited (ie, count the number of times a location appears in Table1).
I have tried many methods, including Calculated Column, Collections, CountIf, AddColumns, but have hit a wall at every turn.
The latest code I have tried (I put this in the OnSelect for the "Update Chart" button):
ClearCollect(loclist,Table2S.Name);
Collect(loclist1,AddColumns(loclist,"LocationCount",CountIf(Table1S,Location=loclist));
My simple idea was to create a collection with two columns and then use this collection to populate the pie chart. The 2 columns in the collection is:
Column 1 -- list of locations (as per Table2)
Column 2 -- the number of times the location is visited (using countif on Table1).
The above codes doesn't work. Perhaps there is an easier solution to this?
Hope that the gurus here can help.
Thanks.