cancel
Showing results for 
Search instead for 
Did you mean: 
rampprakash

How to get Quarters from Date in Canvas PowerApps

Implementation Steps:

 

1. Navigate to https://make.powerapps.com

 

1.jpg

 

2. Select Apps --> Select New App --> Select Canvas

 

3. Once Page Opened Input the name and Select Tablet or Phone depends on your requirement, from my end am selecting Tablet Mode

 

2.jpg

 

4. Once Page Get Opened  --> Add a Label by Selecting (Insert --> Label) and Add a Button as Well

 

3.jpg

 

5. Now Select the Button and go to OnSelect and Write below code Logic

 

4.jpg

 

Code For Converting Date to Quarter

If(
    Month(Now())<=3,
        Set(getQuarterFromDate,"1"),
    Month(Now())>=04 && Month(Now())<=06,
        Set(getQuarterFromDate,"2"),
    Month(Now())>=07 && Month(Now())<=09,
        Set(getQuarterFromDate,"3"),
    Month(Now())>=10,
        Set(getQuarterFromDate,"4")
)

6. Now Set the Default Value to getQuarterFromDate

5.jpg

 

7. Now Click on the Button

 

 

You will see the Current Quarter Value there.

 

That's it 🙂

Comments
Anonymous

Can I make a suggestion? You could simplify your formula with the following:

 

Set(getQuarterFromDate, RoundUp(Month(Now()) / 3, 0))

 

This will divide the current month by the number of months in a quarter (3) and round up that value to the nearest whole number.

 

Thanks.