cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HD
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
yashag2255
Dual Super User II
Dual Super User II

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
yashag2255
Dual Super User II
Dual Super User II

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!
HD
Regular Visitor

thanks! works like a charm

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,209)