Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Newbie22
Resolver I
Resolver I

How do I group hire date by fiscal year and then add comment?

Hi Everyone, I hope y'all enjoyed the holidays 😄

 

I'd like to ask for your help and give me tips on how to group hire dates by fiscal year.

 

I have a "Country Hire Date" column and I need to group them by Fiscal Year. We're using state fiscal year so that's July 1 through June 30 of the following year,and is named for the calendar year in which it ends (e.g., July 1, 2021 through June 30, 2022 is FY22).

 

Once FY is identified, I also need to insert comment per line. Below are the comments and descriptions:

 

CommentsDescription
Joined less than 1 yearCountry Hire Date is within the current fiscal year
Joined 1st fiscal yearCountry Hire Date is previous fiscal year/equal to 1 fiscal year
Joined 2nd fiscal yearCountry Hire Date is equal to 2 previous fiscal years

 

Here's the output I needed:

 

NameCountry Hire DateFiscal YearComments
A1/4/2021FY21Joined 2nd fiscal year
B12/18/2021FY22Joined 1st fiscal year
C10/7/2021FY22Joined 1st fiscal year
D7/14/2022FY23Joined less than 1 year
E9/20/2022FY23Joined less than 1 year
F6/27/2022FY22Joined 1st fiscal year
G8/18/2020FY21Joined 2nd fiscal year
H7/2/2021FY22Joined 1st fiscal year
I11/30/2020FY21Joined 2nd fiscal year
J5/29/2022FY22Joined 1st fiscal year

 

 

Thank you so much for your help 🤗

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Newbie22 ,

 

Please try this:

Comments = 
VAR _year1 =
    IF (
        MONTH ( 'Table'[Country Hire Date] ) <= 6,
        YEAR ( 'Table'[Country Hire Date] ) - 1,
        YEAR ( 'Table'[Country Hire Date] )
    )
VAR _year2 =
    IF ( MONTH ( TODAY () ) <= 6, YEAR ( TODAY () ) - 1, YEAR ( TODAY () ) )
VAR _year = _year2 - _year1
VAR _comments =
    SWITCH (
        TRUE (),
        _year = 0, "Joined less than 1 year",
        _year = 1, "Joined 1st fiscal year",
        _year = 2, "Joined 2nd fiscal year"
    )
RETURN
    _comments

vcgaomsft_0-1672900899635.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Newbie22 ,

 

Please try this:

Comments = 
VAR _year1 =
    IF (
        MONTH ( 'Table'[Country Hire Date] ) <= 6,
        YEAR ( 'Table'[Country Hire Date] ) - 1,
        YEAR ( 'Table'[Country Hire Date] )
    )
VAR _year2 =
    IF ( MONTH ( TODAY () ) <= 6, YEAR ( TODAY () ) - 1, YEAR ( TODAY () ) )
VAR _year = _year2 - _year1
VAR _comments =
    SWITCH (
        TRUE (),
        _year = 0, "Joined less than 1 year",
        _year = 1, "Joined 1st fiscal year",
        _year = 2, "Joined 2nd fiscal year"
    )
RETURN
    _comments

vcgaomsft_0-1672900899635.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

amitchandak
Super User
Super User

@Newbie22 , Create a new column

Diff =

Var _st = year( if(month([Hire Date])<= 6, year([Hire Date]) -1, year([Hire Date])), 7,1)

Var _curr= year( if(month(today())<= 6, year(today()) -1, year(today())), 7,1)

return

datediff(_st, _curr, Year)

 

Based on value 0,1,2,3 you can use switch statement to have a text column

 

Switch-Case statement of #PowerBI: https://www.youtube.com/watch?v=gelJWktlR80&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=56

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.