cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HD
Level: Powered On

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

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

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

HD
Level: Powered On

Re: Populate collection with missing days/dates

thanks! works like a charm

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,215)