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

Get all days of a month and order by number

Hi everybody, 

 

I'm creating an annual calendar. I need to get all days for each month like this 

 

=================2020================

JANUARY    FEBRUARY

Mon  1               Wed 1

Tue    2               Thu  2

Wed  3                Fri   3

Thu   4                Sat  4

Fri     5                Sun 5

 

So i've created a gallery for each month but actually the items are a list of 31 days like [1;2;3;4......]

 

How can i do to get all days of a month formatted like that "Mon 1" 

 

 

Many thanks for help. 

 

Regards, 

 

Jean-Michel DOS SANTOS

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@jeanm 

This is easier to demonstrate than to explain.  So, attached is a sample annual calendar app.  Download it and save to your computer.  Open a new or existing app in PowerApps designer.  Go to the File menu.  Choose Open.  Choose Browse and then locate the file you saved to open.

 

Key items to observe.  There is a main Gallery with 12 rows (horizontal).  Each row as a sub gallery in it (vertical).

Formula on the primary Gallery Items:

ForAll(
    Sequence(12),
    {
     Start: Date(Value(Label3.Text), Value, 1),
     End: DateAdd(DateAdd(Date(Value(Label3.Text), Value, 1), 1, Months), -1, Days)
    }
)

NOTE: in this particular app, there is a Label3 that indicates the Year (and can be changed via left and right arrow).  This formula derives year from that label.

 

The sub gallery of days has the following formula on the Items property:

ForAll(
    Sequence(DateDiff(ThisItem.Start, ThisItem.End, Days)+1), 
    Date(Value(Label3.Text), Month(ThisItem.Start), Value)
)

 

The rest is just labels for formatting the day.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

1 REPLY 1
Super User III
Super User III

@jeanm 

This is easier to demonstrate than to explain.  So, attached is a sample annual calendar app.  Download it and save to your computer.  Open a new or existing app in PowerApps designer.  Go to the File menu.  Choose Open.  Choose Browse and then locate the file you saved to open.

 

Key items to observe.  There is a main Gallery with 12 rows (horizontal).  Each row as a sub gallery in it (vertical).

Formula on the primary Gallery Items:

ForAll(
    Sequence(12),
    {
     Start: Date(Value(Label3.Text), Value, 1),
     End: DateAdd(DateAdd(Date(Value(Label3.Text), Value, 1), 1, Months), -1, Days)
    }
)

NOTE: in this particular app, there is a Label3 that indicates the Year (and can be changed via left and right arrow).  This formula derives year from that label.

 

The sub gallery of days has the following formula on the Items property:

ForAll(
    Sequence(DateDiff(ThisItem.Start, ThisItem.End, Days)+1), 
    Date(Value(Label3.Text), Month(ThisItem.Start), Value)
)

 

The rest is just labels for formatting the day.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (49,566)