Skip to main content

Notifications

Power Apps - Power Apps Pro Dev & ISV
Suggested answer

View to add data from two tables (trips and COUNT() of items)

Posted on by 15
I am trying to get make a view or other way to get data, for a trip and count of items transported.
 
I am using Dataverse.
TripTable is the main table, with and id (trip_id).
TripItems is a table holding items in a specific transport. It holds it own ID field, and a trip_id field to mark which trip it belongs to.
It can be an indendepent table, or lookup towards trip table.
 
I want to read some items from trip table, say id, departure_time and destination.
Then the count of rows in the Items table, where the trip_id is matching.
 
I have tried a view and to create an object using AddColoumns, but have not found the solution
 
In SQL, it would be easy:
 
select trip.id, trip.departure_time, trip.destination,
  (select count(id) from tripItems as ti where ti.trip_id=trip.id) as count
from trips
WHERE trip.deleted=0
Order by - would be lovely here
 
How can I do this using Dataverse and PowertApps?
  • Suggested answer
    SaiRT14 Profile Picture
    SaiRT14 1,334 on at
    View to add data from two tables (trips and COUNT() of items)
    pls try the following:
     

    Consider creating a Rollup Column in Dataverse:

    • Go to TripTable in Dataverse and create a Rollup Column for counting related TripItems records.
    • Configure it to count rows in TripItems where trip_id matches the current TripTable row.
  • ronaldwalcott Profile Picture
    ronaldwalcott 1,167 on at
    View to add data from two tables (trips and COUNT() of items)
    You could try creating a view on the TripItems table and include the columns from the TripTable which you need then apply the count after reading the data in PowerApps.
  • Suggested answer
    MichaelFP Profile Picture
    MichaelFP 1,484 on at
    View to add data from two tables (trips and COUNT() of items)
    Yeas, but you need to use group by of the fetchxml Aggregate data using FetchXml - Power Apps | Microsoft Learn
     
    With that you will be able to get the count rows for the child table.
     
    If my answer helped you, please give me a thumbs up (👍). If solve your question please mark as answer ✔️. This is help the community.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,591

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,090

Leaderboard