cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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
RandyHayes
Super User III
Super User III

@Anonymous 

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 below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

1 REPLY 1
RandyHayes
Super User III
Super User III

@Anonymous 

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 below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (4,061)