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. 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
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. 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
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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (80,438)