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 / Displaying date quarte...
Power Apps
Unanswered

Displaying date quarter in a label

(0) ShareShare
ReportReport
Posted on by 223

Hi
I have a list called ListA.

caslasgee_0-1715358577087.png

I have added a Gallery with a Date Picker (dtp) and also added a label to show if the selected date is the Quarter 1,2,3 etc.

I am able to show if the date picker is selected then based on the month, ts shows Q1 through Q4 (1 Year) in the label using the below.

If(Month(dtp.SelectedDate) in [1,2,3], 
Date(Year(dtp.SelectedDate), 3,31),
If(Month(dtp.SelectedDate) in [4,5,6], 
Date(Year(dtp.SelectedDate), 6,30),
If(Month(dtp.SelectedDate) in [7,8,9], 
Date(Year(dtp.SelectedDate), 9,30),
If(Month(dtp.SelectedDate) in [10,11,12], 
Date(Year(dtp.SelectedDate), 12,31),
If(Month(dtp.SelectedDate) in [1,2,3], 
Date(Year(dtp.SelectedDate) +1,3,31),
If(Month(dtp.SelectedDate) in [4,5,6], 
Date(Year(dtp.SelectedDate) +1,6,30),
If(Month(dtp.SelectedDate) in [7,8,9], 
Date(Year(dtp.SelectedDate) +1,9,30),
If(Month(dtp.SelectedDate) in [10,11,12],
Date(Year(dtp.SelectedDate) +1,12,31),
If(Month(dtp.SelectedDate) in [1,2,3],
Date(Year(dtp.SelectedDate) +2,3,31),
If(Month(dtp.SelectedDate) in [4,5,6],
Date(Year(dtp.SelectedDate) +2,6,30),
If(Month(dtp.SelectedDate) in [7,8,9],
Date(Year(dtp.SelectedDate) +2,9,30),
If(Month(dtp.SelectedDate) in [10,11,12],
Date(Year(dtp.SelectedDate) +2,12,31)
))))))))))))

This works in the label by showing the last date of the 3rd Month month as far as it falls within the selection.

 

What i want to achieve is to use Q1 to represent the first 3 months using the Start Column as the basis. ie,

When 5/2/2024 is selected, It should show Q1 instead of 8/31/2024. and so on!

 

Thanks.

Categories:
I have the same question (0)
  • Meekou Profile Picture
    on at

    How did you get "8/31/2024" when 5/2/2024 selected? I made a test with your formula, if 5/2/2024 selected, it will return 6/30/2024.

    In addition, why it should show Q1 which based on my understand it should Q2 for 5/2/2024.

    If you want to show QA for the first 3 monthgs, try something like

     

    If(
     Month(dtp.SelectedDate) <= 3,
     "Q1",
     If(
     Month(dtp.SelectedDate) <= 6,
     "Q2",
     If(
     Month(dtp.SelectedDate) <= 9,
     "Q3",
     "Q4"
     )
     )
    )

     

  • caslasgee Profile Picture
    223 on at

    @Meekou. Thanks for your response. To respond to your queries, I have a start date and an end date. First 3 months of my start date is my 1st quarter.  Lets say Start date is June/1/2023 the end of my 1st quarter would be September 30, 2023 and so on.

     

    For showing the quarters in text ie, Q1, Q2 etc, based on what you have provided, it only stops at Q4, I want it to go above Q4 - Q12 as the project duration is 12 Quarters in total.

    Thanks.

  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    hey @caslasgee 

     

    can u try this please:

    If(Month(dtp.SelectedDate) in [1, 2, 3], "Q1",
     Month(dtp.SelectedDate) in [4, 5, 6], "Q2",
     Month(dtp.SelectedDate) in [7, 8, 9], "Q3",
     Month(dtp.SelectedDate) in [10, 11, 12], "Q4")
    

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • caslasgee Profile Picture
    223 on at

    Thanks @mmbr1606 , The above code works for sure. But my quarter could start in the middle of the year not necessarily January. Take it like you have a project that starts in July 2023 and will be ending in September 2024 (5 Quarters). Using the above dates as example, when user selects let say a date in December 2023, It tells them that this is the 2nd Quarter of the Project. See below

    caslasgee_0-1715703749907.png

     

    So when a user selects a date within range, It tells the user the quarter of the year.

     

    Thanks.

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