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
tylerspck
Frequent Visitor

Adding Day of Year column to Date Table with Financal Years not aligning with year

Hello All,

I am trying to add a column to my dates table where I am adding day of the year, but based off another column with a different Financial/Sales year

1 ACCEPTED SOLUTION

Here is a Date Table and Non-Related FY (by year) Table

fhill_0-1626374071517.png

 

1. Based on DATE in DateTable, search the FY Start and End Columns to determine which FY Year each Date falls into....

FY_Search = CALCULATE( VALUES('Table (2)'[FY]),
FILTER('Table (2)', 'Date Table'[Date] > 'Table (2)'[FY Start] && 'Date Table'[Date] < 'Table (2)'[FY End]))
 2.  Now that we know each year, go lookup the FY Start Date again (or merge this and the next query together...)
FY_Start_lookup = LOOKUPVALUE('Table (2)'[FY Start], 'Table (2)'[FY],'Date Table'[FY_Search])
 3.  Now that we know the FY Start Date, we can just DateDiff from DATE to get days.
Date_Diff = DATEDIFF('Date Table'[FY_Start_lookup], 'Date Table'[Date],DAY)
 
fhill_1-1626374112252.png

 

 




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




View solution in original post

4 REPLIES 4
fhill
Resident Rockstar
Resident Rockstar

Could you please post an example set of columns?  What determines the 'Start of Year' from the 'other column'?

 

 




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




The Start Date for the year is always changing due to retail business and wanting to compare holiday weeks to holiday weeks year after year. 2021 year started 1/3 and ends 1/1, 2020 started 12/29 and ended 1/2.

I have the typical date table and merged a custom sales/financial year table off of the date[date] column,  I just need to find a way to have day of year based off of the sales/financial year column since I never have a definitive start and stop every year

Here is a Date Table and Non-Related FY (by year) Table

fhill_0-1626374071517.png

 

1. Based on DATE in DateTable, search the FY Start and End Columns to determine which FY Year each Date falls into....

FY_Search = CALCULATE( VALUES('Table (2)'[FY]),
FILTER('Table (2)', 'Date Table'[Date] > 'Table (2)'[FY Start] && 'Date Table'[Date] < 'Table (2)'[FY End]))
 2.  Now that we know each year, go lookup the FY Start Date again (or merge this and the next query together...)
FY_Start_lookup = LOOKUPVALUE('Table (2)'[FY Start], 'Table (2)'[FY],'Date Table'[FY_Search])
 3.  Now that we know the FY Start Date, we can just DateDiff from DATE to get days.
Date_Diff = DATEDIFF('Date Table'[FY_Start_lookup], 'Date Table'[Date],DAY)
 
fhill_1-1626374112252.png

 

 




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




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.