Posts

Showing posts with the label Calendar

Get start and last date of month using Power Apps

Image
In a previous post, we looked at how to get first date and last date of a month using expressions in Power Automate.  In this post, we are going to look at how we can get the same information in Power Apps. Here, we have used Today() to get the dates based on current date, however it can be made even more dynamic by using DatePicker and replacing Today() with DatePicker1.SelectedDate All dates calculated in this post are in the US format: MM-DD-YYYY First Day of Month DateValue(Month(Today()) & "/" & "1" & "/" & Year(Today())) First Day of Next Month In this step, we add 1 month to the first day of the current month DateAdd(     DateValue (Month(Today()) & "/" & "1" & "/" & Year(Today())),     1,     Months ) Last Day of Month In this step, we subtract 1 day from the first day of the next month DateAdd(     DateAdd(         DateValue (Month(Today()) & "/" & "1" ...

Get start date of month and last date of month dynamically from Power Automate

Image
There can be multiple business use cases where you want to know start date and end date of the month in a dynamic manner, either where a date is provided to you, or you are using current date. For example, if you want to filter your data-source to show records for an entire month. This can be achieved using expressions within Power Automate. In this post, we are using current date/time to obtain first and last date of the month. Start date of the month startOfMonth(utcNow(),'yyyy-MM-dd') Last date of the month There is no in-built function to calculate last day of month, so we will first calculate first day of the next month and then subtract 1 day from it. First date of next month : startOfMonth(addToTime(utcNow(),1,'month'),'yyyy-MM-dd') Last date of current month: addDays(startOfMonth(addToTime(utcNow(),1,'month')),-1,'yyyy-MM-dd')

Show A DropDown In PowerApps Containing Only Remaining Months In The Year

Image
Within your Power Apps, you want to have a DropDown control which will show only the remaining months of the year. For example, if you are opening the Power App in September DropDown control will show you months from September to December only. We can achieve this in three steps as below: Create a collection which contains all months as text Create another collection, which appends month-number to each month Add a DropDown control and Filter collection from step 2 to show only months where month-number is greater than or equal to current month number 1 - Create a collection of all months This can be done by adding formula below at App OnStart: Collect(     colMonths,     Calendar.MonthsLong() ); This will give a collection of 12 rows, one for each month: January, February, …, December 2 - Append Month-Number to this collection This can be done by adding formula below just after the step 1 ForAll(     colMonths,     Collect(    ...