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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
angie9127
New Member

Condition for month/year not working

Can anyone help with this formula? I created a new column in my calendar table to name the quarter as follows. The first block works well, but when it has to look for the month again, it stops working and leaves everything blank as if there were no more conditions to look for.

 

FiscalQtr =
    IF(MONTH(Calendario[Date])in{10, 11, 12},
        IF(YEAR(Calendario[Date])in{2021},"FY2021Q3",
        IF(YEAR(Calendario[Date])in{2022},"FY2122Q3",
        IF(YEAR(Calendario[Date])in{2023},"FY2223Q3",
        IF(YEAR(Calendario[Date])in{2024},"FY2324Q3",
    IF(MONTH(Calendario[Date])in{1, 2, 3},
        IF(YEAR(Calendario[Date])in{2021},"FY2021Q4",
        IF(YEAR(Calendario[Date])in{2022},"FY2122Q4",
        IF(YEAR(Calendario[Date])in{2023},"FY2223Q4",
        IF(YEAR(Calendario[Date])in{2024},"FY2324Q4",
    IF(MONTH(Calendario[Date])in{4, 5, 6},
        IF(YEAR(Calendario[Date])in{2021},"FY2021Q1",
        IF(YEAR(Calendario[Date])in{2022},"FY2122Q1",
        IF(YEAR(Calendario[Date])in{2023},"FY2223Q1",
        IF(YEAR(Calendario[Date])in{2024},"FY2324Q1",
    IF(MONTH(Calendario[Date])in{7, 8, 9},
        IF(YEAR(Calendario[Date])in{2021},"FY2021Q2",
        IF(YEAR(Calendario[Date])in{2022},"FY2122Q2",
        IF(YEAR(Calendario[Date])in{2023},"FY2223Q2",
        IF(YEAR(Calendario[Date])in{2024},"FY2324Q2"))))))))))))))))))))
1 ACCEPTED SOLUTION
Payeras_BI
Solution Sage
Solution Sage

Hi @angie9127 ,

Try this:

Your column = 
SWITCH(
    TRUE(),
    MONTH('Date'[Date]) in {10,11,12},"FY"&RIGHT(YEAR('Date'[Date])-1,2)&RIGHT(YEAR('Date'[Date]),2)&"Q3",
    MONTH('Date'[Date]) in {1,2,3},"FY"&RIGHT(YEAR('Date'[Date])-1,2)&RIGHT(YEAR('Date'[Date]),2)&"Q4",
    MONTH('Date'[Date]) in {4,5,6},"FY"&RIGHT(YEAR('Date'[Date])-1,2)&RIGHT(YEAR('Date'[Date]),2)&"Q1",
    MONTH('Date'[Date]) in {7,8,9},"FY"&RIGHT(YEAR('Date'[Date])-1,2)&RIGHT(YEAR('Date'[Date]),2)&"Q2"
)

 

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain

View solution in original post

3 REPLIES 3
Payeras_BI
Solution Sage
Solution Sage

Hi again @angie9127 ,
Or this:

 

Your column ii =
"FY" & RIGHT ( YEAR ( 'Calendario'[Date] ) - 1, 2 ) & RIGHT ( YEAR ( 'Calendario'[Date] ), 2 ) 
& "Q" & IF ( QUARTER ( 'Calendario'[Date] ) = 1, 4, QUARTER ( 'Calendario'[Date] ) - 1 )

 

 

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain
Payeras_BI
Solution Sage
Solution Sage

Hi @angie9127 ,

Try this:

Your column = 
SWITCH(
    TRUE(),
    MONTH('Date'[Date]) in {10,11,12},"FY"&RIGHT(YEAR('Date'[Date])-1,2)&RIGHT(YEAR('Date'[Date]),2)&"Q3",
    MONTH('Date'[Date]) in {1,2,3},"FY"&RIGHT(YEAR('Date'[Date])-1,2)&RIGHT(YEAR('Date'[Date]),2)&"Q4",
    MONTH('Date'[Date]) in {4,5,6},"FY"&RIGHT(YEAR('Date'[Date])-1,2)&RIGHT(YEAR('Date'[Date]),2)&"Q1",
    MONTH('Date'[Date]) in {7,8,9},"FY"&RIGHT(YEAR('Date'[Date])-1,2)&RIGHT(YEAR('Date'[Date]),2)&"Q2"
)

 

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain

Thanks J.Payeras - this really helped solving the problem. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.