cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Populate collection with missing days/dates

Hello Everyone,

 

If I have a collection with some data:

 

Date               x  y   z

01/09/2019  15 32 16

02/09/2019  15  0   12

05/09/2019   1   3    0

15/09/2019   0   1    0

25/09/2019   0   0    55

 

How would you fill all the missing dates with 0  0 0 value to obtain something like :

 

 

Date               x  y   z

01/09/2019  15 32 16

02/09/2019  15  0   12

03/09/2019   0   0    0

04/09/2019   0   0    0

05/09/2019   1   3    0

06/09/2019   0   0    0

....

15/09/2019   0   1    0

16/09/2019   0   0    0

....

25/09/2019   0   0    55

....

30/09/2019   0   0    0

Or would you do it another way?

The goal is to have a gallery with every day of the selected month, with data coming from another data source.

 

 

Cheers

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Populate collection with missing days/dates

Hi @HD 

 

Considering you want to do this for current month, please use the expression:
 
ForAll(FirstN([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],DateDiff(Date(Year(Today()), Month(Today()), 1),Date(Year(Today()), Month(Today()) + 1, 1))),If(!(Text(Date(Year(Today()), Month(Today()), 1+Value),"[$-en-US]dd/mm/yyyy") in testcol1.Date),Collect(testcol1,{Date:Text(Date(Year(Today()), Month(Today()), 1+Value),"[$-en-US]dd/mm/yyyy"),A:0,B:0,C:0})))
 
This will update the existing collection with the 0 value for dates that does not exist. Here, testcol1 is the name of my collection.
 
If this differs, please more specifics so that we may help you better.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

2 REPLIES 2
Highlighted
Dual Super User III
Dual Super User III

Re: Populate collection with missing days/dates

Hi @HD 

 

Considering you want to do this for current month, please use the expression:
 
ForAll(FirstN([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],DateDiff(Date(Year(Today()), Month(Today()), 1),Date(Year(Today()), Month(Today()) + 1, 1))),If(!(Text(Date(Year(Today()), Month(Today()), 1+Value),"[$-en-US]dd/mm/yyyy") in testcol1.Date),Collect(testcol1,{Date:Text(Date(Year(Today()), Month(Today()), 1+Value),"[$-en-US]dd/mm/yyyy"),A:0,B:0,C:0})))
 
This will update the existing collection with the 0 value for dates that does not exist. Here, testcol1 is the name of my collection.
 
If this differs, please more specifics so that we may help you better.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted
Regular Visitor

Re: Populate collection with missing days/dates

thanks! works like a charm

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,862)