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)
Solved! Go to Solution.
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:
"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.
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:
"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.
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.
You could also use the Switch() function instead of nested ifs, if you'd like to make the code easer to handle.
You can just use Set(currentquarter, if(month(today())=1, "quarter 1" etc
"Q" & RoundUp(Month(<date>')/3,0)
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")
)
This is really clever!
Another way to get the Quarter is to divide the month by 3 and round the result up.
RoundUp(Month(Date)/3,0)
User | Count |
---|---|
260 | |
109 | |
93 | |
56 | |
41 |