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

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

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,128)