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
Sania-F
Frequent Visitor

Getting EOF error while creating custome column

I am trying to create a custom column based on calendar date to calculate fiscal quarter but getting EOF error. Kindly help.
SaniaF_0-1702884153419.png

 
FiscalQuarter 
=VAR FiscalYearStartMonth = 9 //this line giving error
VAR CurrentMonth = MONTH('YourTable'[CalendarDate])
VAR FiscalYearAdjustment =
IF(
CurrentMonth >= FiscalYearStartMonth,
YEAR('YourTable'[CalendarDate]),
YEAR('YourTable'[CalendarDate]) - 1
)
VAR FiscalMonthAdjusted =
IF(
CurrentMonth < FiscalYearStartMonth,
CurrentMonth + 12,
CurrentMonth
)
VAR Quarter = INT((FiscalMonthAdjusted - FiscalYearStartMonth) / 3) + 1
RETURN
"Q" & Quarter & " " & FiscalYearAdjustment

1 ACCEPTED SOLUTION
Sania-F
Frequent Visitor

I was trying to add custom column from power query editor and was getting error. 

Then I discarded creating custom column from there and went into report view.

In report view , I went to desired table and added new column. That helped me get rid of error and calculate the quarter successfully.

View solution in original post

3 REPLIES 3
Sania-F
Frequent Visitor

I was trying to add custom column from power query editor and was getting error. 

Then I discarded creating custom column from there and went into report view.

In report view , I went to desired table and added new column. That helped me get rid of error and calculate the quarter successfully.

PijushRoy
Super User
Super User

Hi @Sania-F 

Please download the pbix file and go to Power Query and check how I calculate FiscalQuarter

Assuming Fiscal Year start from April and end is March (please change the custom column logic as per your requirement)
So April, May, June - Quarter 1
July, Aug, Sep - Quarter 2 
so

https://drive.google.com/file/d/1z4gz5hDIh9QZdfxQXXt-q88Sa9bmXW3l/view?usp=sharing

 

If solved your requirement, please mark this answer as SOLUTION.
If this comment helps you, appreciate your KUDOS

Thanks 

Pijush

Hi @Sania-F 

If it is solved, please mark it as a solution and close it.

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.