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 / Shuffle collection bas...
Power Apps
Answered

Shuffle collection based on date

(0) ShareShare
ReportReport
Posted on by 102

Hi there

 

I am creating a app that a department admin just clicks on a button to select a winner based on.

I want to be able to sort these by month but also if there was noone tagged for that month it looks at the previous month for the winner.

 

At the moment i have a collection called "ShuffledNames" (datasource sharepoint list) which will have the email of the tagged user and comments showing. On the button i put in the below command on the "onselect" property. The shuffle works but i want to be able to get data for the current month and if no data for that month then look at previous month. I have tried to sortbycolumns, using "Messages" column which has the dates of when the posts were posted but no luck. Any suggestions please?

 

ClearCollect(
ShuffledNames,
Shuffle('Appreciation - National Operations'),SortByColumns('Appreciation - National Operations',"Messages",SortOrder.Ascending)
)

Categories:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @BianceBee ,

     

    Please try:

    ClearCollect(
    ShuffledNames,
    If(
     IsBlank(LookUp(DataSource,DatTimeColumn>=Date(Year(Today()),Month(Today()),1))),
     Filter(DataSource,DatTimeColumn>=DateAdd(Date(Year(Today()),Month(Today()),1),-1,TimeUnit.Months)),
     Filter(DataSource,DatTimeColumn>=Date(Year(Today()),Month(Today()),1))
    ))

     

    Best Regards,
    Bof

  • BianceBee Profile Picture
    102 on at

    thanks for this @v-bofeng-msft 

     

    it worked. I just added the shuffle option so it shuffles. Thank you for this 🙂

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard