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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Adding same columns wi...
Power Apps
Answered

Adding same columns with data from another column

(0) ShareShare
ReportReport
Posted on by 168

Hi,

I am trying to create a chart with sum of the values with the same date, with the help of "eka24" I was able to get the code for it, but now the problem is I am not getting the sum of the values.

 

The code I am using is,

 

ClearCollect(
 MyRequest,
 Filter(
 AddColumns(
 GroupBy(
 'All Requests',
 "Deadline",
 "AllSlides"
 ),
 "TotalSlides",
 Sum(
 AllSlides,
 'Slide Count'
 )
 ),
 Deadline >= Today()
 )
);

 

But the output I am getting is

Screenshot 2020-07-05 at 11.19.52 PM.png

 

for Date 06/07 it should sum the values and show one bar with the value 36 and same with others also. And only show bars of 3 days that is today, tomorrow and day after that. Also, the collection is very much required as it is used for validation also.

 

The table is as follows,

Screenshot 2020-07-06 at 12.35.39 AM.png

 

Thanks

Categories:
  • WarrenBelz Profile Picture
    156,576 Most Valuable Professional on at

    Hi @ramanan89 ,

    Before looking at anything else, try this

    ClearCollect(
     MyRequest,
     AddColumns
     GroupBy(
     Filter(
     'All Requests'
     Deadline >= Today()
     ),
     "Deadline",
     "AllSlides"
     ),
     "TotalSlides",
     Sum(
     AllSlides,
     'Slide Count'
     )
     )
    )

     

    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.

  • ramanan89 Profile Picture
    168 on at

    Thanks. But still gives the same chart, 😞

    ClearCollect(
     MyRequest,
     AddColumns(
     GroupBy(
     Filter(
     'All Requests',
     Deadline >= Today()
     ),
     "Deadline",
     "AllSlides"
     ),
     "TotalSlides",
     Sum(
     AllSlides,
     'Slide Count'
     )
     )
    );
  • WarrenBelz Profile Picture
    156,576 Most Valuable Professional on at

    Thanks @ramanan89 ,

    Breaking this down as per comments below

    ClearCollect(
     MyRequest, //Collection MyRequest
     AddColumns( //add columns below
     GroupBy( //group below
     Filter( //show only 
     All Requests', //from list 'All requests'
     Deadline >= Today() //records where deadline today or beyond
     ),
     "Deadline", //group by deadline date
     "AllSlides" //put rest of fields in this table
     ),
     "TotalSlides", //add column TotalSlides
     Sum( //which is the sum of
     AllSlides, //the fields belonging to the deadline date
     'Slide Count' //of the 'Slide Count' numeric field
     )
     )
    )

    This code should show the sum of the field 'Slide Count' in each Deadline group. You might have to look at your data unless what I have put above is not what you want.

     

    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.

  • ramanan89 Profile Picture
    168 on at

    Thanks.

    Yes, everything is right. I even tried generating a data table and it shows the same error,

    Screenshot 2020-07-06 at 3.57.46 PM.png

     

    Or is it because of time with date, should we only compare the date value. Since the date and time are different it might not be grouping. 

     

     

  • Verified answer
    WarrenBelz Profile Picture
    156,576 Most Valuable Professional on at

    @ramanan89 ,

    I think you have it now - Deadline needs to be a date only field (I assumed it was) - not time and date.

    I cannot test this, but try

    ClearCollect(
     MyRequest,
     AddColumns
     GroupBy(
     AddColumns(
     Filter(
     'All Requests'
     Deadline >= Today()
     ),
     "DLDate",
     Text(Deadline,"dd/mm/yyyy")
     ),
     "DLDate",
     "AllSlides"
     ),
     "TotalSlides",
     Sum(
     AllSlides,
     'Slide Count'
     )
     )
    )

     

    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.

  • ramanan89 Profile Picture
    168 on at

    Thanks.. Will check it and let you know

  • ramanan89 Profile Picture
    168 on at

    This works finally. Thank you so much 🙂

  • ramanan89 Profile Picture
    168 on at

    Hi, one more help. How do I sort the Date column in Ascending order and also show only top 3 entries. Thanks 🙂

  • Verified answer
    WarrenBelz Profile Picture
    156,576 Most Valuable Professional on at

    Hi @ramanan89 ,

    I cannot possibly test this, but something like the below might work.

    ClearCollect(
     MyRequest,
     AddColumns
     GroupBy(
     AddColumns(
     FirstN(
     Sort(
     Filter(
     'All Requests'
     Deadline >= Today()
     ),
     Deadline,
     Descending
     ),3
     ),
     "DLDate",
     Text(Deadline,"dd/mm/yyyy")
     ),
     "DLDate",
     "AllSlides"
     ),
     "TotalSlides",
     Sum(
     AllSlides,
     'Slide Count'
     )
     )
    )

     

    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.

     

  • ramanan89 Profile Picture
    168 on at

    Thank you this works 🙂

    I had changed the Descending to Ascending order, but it was showing only 2 bars in the graph. So had to change the number to 4 to show 3 bars. Not sure if that is right. But I am getting the desired output.

     

    Edit

     

    Same issue, it goes back to 2 bars. I feel something wrong somewhere 😞

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 396 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 323

#3
WarrenBelz Profile Picture

WarrenBelz 193 Most Valuable Professional

Last 30 days Overall leaderboard