web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Converting Date to Qua...
Power Apps
Unanswered

Converting Date to Quarters

(0) ShareShare
ReportReport
Posted on by

Good Day Everyone,

 

I am needing some assistance with converting current date to the current quarter and taking the current quarter date to define which months are being looked over. The data is from SharePoint, in case that's relevant.

 

To go in further depth of what I mean, I know the syntax for getting the current date/time in PowerApps. Is there a way I can convert the date to text and auto populate it indefinitely? (I.E. the current day is 05/04/2018. Based on the month of May (05), we are in Q2 (Quarter 2). Therefor the text field will produce Q2, not 05/04/2018. In 3 months, it will be 08/04/2018, meaning we will be in Q3 (Quarter 3). And this continues even into the next year, and so on.)

 

The other question added on to this would be, is there any way to get PowerApps to understand that if we were in Q2, a text field can auto populate the previous quarter that is undergoing inspection? (I.E. We are in Q2, but the form is about Q1 (Jan., Feb., Mar.), so the text field will show Q1 instead of current Quarter.)

 

I hope this explanation made sense. If there is any extra information that may be needed to solve these, please let me know.

 

Thank you (P.S. I didn't know if this was a flow, formula, or rule/condition/action, so I kept it in General Questions)

Categories:
I have the same question (0)
  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    Hello @Anonymous, 

     

    I needed a similar solution to divide the year into halves. You could adapt it to your needs. Here is what I did: 

     

    1. At first I tried this using a Sharepoint calculated column. Bad idea. PowerApps doesn't play nice with SP Calc columns.
    2. Create the designation in the PowerApp itself.
      1. Choose a control to apply the following formula to. I chose the .OnVisible property of the screen but you could choose a button or other control as well. 

     

    "Sets a variable for dividing year into two halves.";
    If(Text(Today(),"[$-en-US]mm")="01" ||
     Text(Today(),"[$-en-US]mm")="02" ||
     Text(Today(),"[$-en-US]mm")="03" ||
     Text(Today(),"[$-en-US]mm")="04" ||
     Text(Today(),"[$-en-US]mm")="05" ||
     Text(Today(),"[$-en-US]mm")="06",
     Set(thisHalf,"1"),Set(thisHalf,"2")
     );

    You might try something like: 

    "Sets a variable for dividing year into quarters.";
    If(Text(Today(),"[$-en-US]mm")="01" ||
     Text(Today(),"[$-en-US]mm")="02" ||
     Text(Today(),"[$-en-US]mm")="03" ,
     Set(thisQuarter,"1"),
    Text(Today(),"[$-en-US]mm")="04" ||
     Text(Today(),"[$-en-US]mm")="05" ||
     Text(Today(),"[$-en-US]mm")="06" 
     Set(thisQuarter,"2")
     );...............etc.

    ...or, this may be a good candidate for the Switch statement. I don't have enough experience with this one to explain it. 

     

    Props to @Paul_C for helping me with the above in this post.

  • Community Power Platform Member Profile Picture
    on at

    Thank you @ericonline! This did not completely help me, since the dates were not associated with Sharepoint itself. I was actually able to get the form to work through tweaking the information you've offered and many nested formulas, similar to Excel's formulas. For future reference when using tables, I will definitely be using your solution.

  • Community Power Platform Member Profile Picture
    on at

    You could also use the Switch() function instead of nested ifs, if you'd like to make the code easer to handle.

  • Matthewvize Profile Picture
    37 on at

    You can just use  Set(currentquarter, if(month(today())=1, "quarter 1" etc

  • DGreening Profile Picture
    17 on at

     

    "Q" & RoundUp(Month(<date>')/3,0)

  • MrThompson Profile Picture
    24 on at
    If(
     Month(Now())<=3,
     Set(thisQuarter,"1"),
     Month(Now())>=04 && Month(Now())<=06,
     Set(thisQuarter,"2"),
     Month(Now())>=07 && Month(Now())<=09,
     Set(thisQuarter,"3"),
     Month(Now())>=10,
     Set(thisQuarter,"4")
    )
  • Matthewvize Profile Picture
    37 on at

    This is really clever!

  • FadyJnJ Profile Picture
    8 on at

    Another way to get the Quarter is to divide the month by 3 and round the result up.

    RoundUp(Month(Date)/3,0)

  • orengaliki Profile Picture
    47 on at

    Looks great! 

    Can you clarify how the Q's will be visible? 

    the formula shows no errors while in "On Select" or "OnVisible", but I can't seem to be able to use that function in a text label or date picker. 

    An example will be fantastic 🙂

  • VladK Profile Picture
    2 on at

    This works for me: If(RoundDown((Month(Now()))/3,0)=0, 4, RoundDown((Month(Now()))/3,0))

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard