web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Trying to get the max ...
Power Apps
Unanswered

Trying to get the max and min values in a simple table and sum the result

(0) ShareShare
ReportReport
Posted on by 380

I have a simple Sharepoint list called MeterReadings feeding a Gallery in a Powerapp and the data looks like this:

meterrefreading
18367100.6
18367159.7
1836838.28
1836846.5
1837967.77
1837999.52
185854.31
185856.42
1858536


I think I need to do a groupby or a Forall but I can't seem to find the correct syntax or way to achieve this
Basically I want to get the max and min values for each meterref and then sum all those values - and the total should be 120.77

any help greatly appreciated

cheers

Bob

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    152,851 Most Valuable Professional on at
    Re: Trying to get the max and min values in a simple table and sum the result

    Hi @bobgodin ,

    The formula you described is below, but the total of all maximum and minimum values is 552.68

    Sum(
     AddColumns(
     GroupBy(
     SPListName,
     "meterref",
     "Data"
     ),
     "MaxVal",
     Max(
     Data,
     reading
     ),
     "MinVal",
     Min(
     Data,
     reading
     )
     ),
     MaxVal + MinVal
    )

    if you meant Average, this is 138.17

    Average(
     AddColumns(
     GroupBy(
     SPListName,
     "meterref",
     "Data"
     ),
     "MaxVal",
     Max(
     Data,
     reading
     ),
     "MinVal",
     Min(
     Data,
     reading
     )
     ),
     MaxVal + MinVal
    )

     

    Please click Accept as solution 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 Thumbs Up.

    Visit my blog Practical Power Apps

  • bobgodin Profile Picture
    380 on at
    Re: Trying to get the max and min values in a simple table and sum the result

    @WarrenBelz thanks Warren - not quite right - I may have not explained it clearly

    I want to take the min and max values (for example with meterref 18367 - the values are 100.6 and 159.7 and get the difference - in this case 59.1, then do the same for all the other meterefs and the sum the differences - it's about meter usage so we're adding up the difference between each meter read and then summing the difference (usage) to get an overall usage for that client. Hope this is clearer now cheers

  • Verified answer
    WarrenBelz Profile Picture
    152,851 Most Valuable Professional on at
    Re: Trying to get the max and min values in a simple table and sum the result

    Hi @bobgodin ,

    It is actually 130.76

    Sum(
     AddColumns(
     GroupBy(
     SPListName,
     "meterref",
     "Data"
     ),
     "ValDiff",
     Max(
     Data,
     reading
     ) - 
     Min(
     Data,
     reading
     )
     ),
     ValDiff
    )

     

    Please click Accept as solution 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 Thumbs Up.

    Visit my blog Practical Power Apps

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard