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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
lt79_Pax
Helper II
Helper II

fn_DaySinceYearStart invocation not functioning in Sales

Dear Power BI Representative,

I attended the Power BI Data Modeling and Shaping Training course and in section 6D step d, the invocation of the function is not resolving to the dates since the year start instead every record is showing a value of 96 and I do not understand why my output is wrong.  The function the text provided was added below.  Under the test invoke function under the transformation tab it is resolving however in sales it is still keeping every record at 96.  Please advise.

 

Thank you.

 

let
Source = (TransactionDate as date) => let
YearStart = #date(Date.Year(TransactionDate),1,1),
#"DateDiff" = Duration.From(TransactionDate-YearStart),
#"NumberDays" = Duration.Days(#"DateDiff")+1
in
#"NumberDays"
in
Source

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@lt79_Pax , Please find my script for the same. I have date column

 

#"Added Custom" = Table.AddColumn(#"Changed Type1", "Year Start", each #date(Date.Year([Date]),1,1)),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Datediff", each Duration.Days([Date]-[Year Start]))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@lt79_Pax , Please find my script for the same. I have date column

 

#"Added Custom" = Table.AddColumn(#"Changed Type1", "Year Start", each #date(Date.Year([Date]),1,1)),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Datediff", each Duration.Days([Date]-[Year Start]))

Thank you Amitchandak.  The [Date] field needed to be used instead of "Select the current date from the calendar" in the lab guide.  Thank you for providing the corrected field.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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