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
Anonymous
Not applicable

Calculated column for FY error in last date

Hi all

 

I got my custom dateKey table that is created in DAX with the following function

_dateKey = CALENDAR(DATE(2018,1,1),DATE(2021,12,31))
In that table I added calculated columns for Year, Month, week, month order and FY.
 
so far so good. My calculated column for FY is the following:
FY = IF(_dateKey[Date]<DATE(_dateKey[Year],4,1),VALUE(FORMAT(_dateKey[Date],"YY")),VALUE(FORMAT(_dateKey[Date]+1,"YY"))+1)
The expected result is that the FY value is the same of the current year (in 2 digit format "YY"). On April 1st starts the next FY, meaning that after March 31st the FY value is the current year + 1. This is worked perfectly but the last value of my dateKey wich is December 31st of 2021 gets FY value 23, seems like a bug for me as this just happends in this date and not in previous December 31st...
 
Capture.JPG
 
 
 
 
 
 
any clue on what's happening?
Cheers.
Pepe
1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

Looks like the code adds 1 day to the date, which for the 31st of Dec pushes into the next year (1,1,2022), then extract the 22 then adds 1.

So that makes 23.

 

View solution in original post

1 REPLY 1
HotChilli
Super User
Super User

Looks like the code adds 1 day to the date, which for the 31st of Dec pushes into the next year (1,1,2022), then extract the 22 then adds 1.

So that makes 23.

 

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.