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
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
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.