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 / Distinct list of month...
Power Apps
Answered

Distinct list of months and years

(0) ShareShare
ReportReport
Posted on by 187

Been racking my brains on this, but not come up with a solution yet.

 

I've got a collection of dates in a range and I'm trying to create a new collection from that, consisting of two columns - the distinct months and the years of those months.

 

e.g. my date range is from 2020-11-14 through to 2021-02-11 and I want the end result to be:

 

November2020
December2020
January2021
February2021

 

Getting the distinct months into a collection is easy enough, but it's adding the corresponding year that I'm stuck on. Any help would be appreciated.

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

    Hi @JamesSnaps :

    I've made a test for your reference:

    1\I assume there is a collection named DateRange

    ClearCollect(
     DateRange,
     ForAll(
     Sequence(DateDiff(Date(2020,11,14),Date(2021,2,11),Days),0,1), 
     {TheDate:DateAdd(Date(2020,11,14),Value,Days)}
     )
    )

    1.JPG

    2\Add a date table control and set it's Items property to:

    ForAll(
     Distinct(
     ForAll(
     DateRange,
     {
     TheValue: Text(
     TheDate,
     "[$-en]mmmm"
     ) & ";;" & Year(TheDate)
     }
     ),
     TheValue
     ),
     {
     TheMonth: First(
     Split(
     Result,
     ";;"
     )
     ).Result,
     TheYear: Last(
     Split(
     Result,
     ";;"
     )
     ).Result
     }
    )

    2.JPG

    Best Regards,

    Bof

  • JamesSnaps Profile Picture
    187 on at

    This is really smart Bof, thanks for the assistance. I've learned some new tricks whilst looking through the solution too!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 84

#2
WarrenBelz Profile Picture

WarrenBelz 79 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 40 Super User 2026 Season 1

Last 30 days Overall leaderboard