Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

How to compare two tables and look for differences?

Posted on 19 Nov 2024 07:42:53 by 2
I have two tables with the same columns. Lets say it is 'ID', 'Name', 'Quantity' and 'Date'. The information under the columns Quantity and Date can change and therefore the tables can differ (Not ID or Name). I want to create an app which with a button or on start up compares the tables and present the differences. How do i make the comparison?
 
  • WarrenBelz Profile Picture
    WarrenBelz 143,246 on 24 Nov 2024 at 09:10:55
    How to compare two tables and look for differences?
    You can add it wherever you want to collect the data - OnStart will work.
  • KN-18111252-0 Profile Picture
    KN-18111252-0 2 on 19 Nov 2024 at 08:58:09
    How to compare two tables and look for differences?
    Do i add this code under 'OnStart' property of the app? Sorry i am new to Power Apps,
  • WarrenBelz Profile Picture
    WarrenBelz 143,246 on 19 Nov 2024 at 08:26:12
    How to compare two tables and look for differences?
    This should produce a Collection with any different fields and the different values
    ForAll(
       Table1 As _T1,
       With(
          {
             _Data: 
             LookUp(
                Table2,
                ID = _T1.ID
             )
          },
          If(
             _Data.Quantity <> _T1.Quantity || _Data.Date <> _T1.Date,
             Collect(
                colDiff,
                {
                   ID: _T1.ID,
                   Name: _T1.Name,
                   Quantity: _T1.Quantity,
                   Quantity2: _Data.Quantity,
                   Date: _T1.Date,
                   Date2: _Data.Date
                }
             )
          )
       )
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

     

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,246

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,884

Leaderboard