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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
djreyes
Helper I
Helper I

Fiscal year

Hello, 

Fiscal year starts April, I tried the formula below but I am getting an error message:

 

Column 2 = if(QUARTER(PowerBi[Document Date].[Quarter])>=2,QUARTER(PowerBi[Document Date].[Quarter])-1,QUARTER(PowerBi[Document Date].[Quarter])+1)

 

The error message is: Cannot convert Qrt 1 of Type Test to type Date. 

 

I feel like I am missing something. Please help.

 

Thank you!

2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

The QUARTER function expects a date, but you're passing in the quarter from the date hierarchy. Try

Column 2 =
IF (
    QUARTER ( PowerBi[Document Date].[Date] ) >= 2,
    QUARTER ( PowerBi[Document Date].[Date] ) - 1,
    QUARTER ( PowerBi[Document Date].[Date] ) + 1
)

View solution in original post

Yep, that should give the right result I think

View solution in original post

7 REPLIES 7
djreyes
Helper I
Helper I

It worked, question though, I am running a report from January to March which is Quarter 1 for calendar year, but in our fiscal year its quarter 4. Its giving me the result of 2 instead of 4. 

Try

Column 2 =
VAR CalendarQuarter =
    IF (
        QUARTER ( PowerBi[Document Date].[Date] ) >= 2,
        QUARTER ( PowerBi[Document Date].[Date] ) - 1,
        QUARTER ( PowerBi[Document Date].[Date] ) + 1
    )
VAR FiscalQuarter =
    MOD ( CalendarQuarter + 3, 4 )
RETURN
    FiscalQuarter

Is giving me 1 not 4. 

Probably easier to just use SWITCH

Column 2 =
VAR CalendarQuarter =
    IF (
        QUARTER ( PowerBi[Document Date].[Date] ) >= 2,
        QUARTER ( PowerBi[Document Date].[Date] ) - 1,
        QUARTER ( PowerBi[Document Date].[Date] ) + 1
    )
VAR FiscalQuarter =
    SWITCH ( CalendarQuarter, 1, 4, 2, 1, 3, 2, 4, 3 )
RETURN
    FiscalQuarter

Still 1, I changed the value to 3 and the result is 4, is that an option? 

Column 2 =
IF (
    QUARTER ( PowerBi[Document Date].[Date] ) >= 2,
    QUARTER ( PowerBi[Document Date].[Date] ) - 1,
    QUARTER ( PowerBi[Document Date].[Date] ) + 3
)

 

Yep, that should give the right result I think

johnt75
Super User
Super User

The QUARTER function expects a date, but you're passing in the quarter from the date hierarchy. Try

Column 2 =
IF (
    QUARTER ( PowerBi[Document Date].[Date] ) >= 2,
    QUARTER ( PowerBi[Document Date].[Date] ) - 1,
    QUARTER ( PowerBi[Document Date].[Date] ) + 1
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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