Forum Discussion
M Query Syntax help
The error is the reference to your previous step - #"Week Start". You need to reference your previous step. In your query, on the Add Column tab, add Custom Column and put the Date.ToText( ....) part in the box that comes up. Also make sure the column with date values is called [Date], otherwise change that too.
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
- CaveOfWonders6 years ago
Helper IV
Thank you for your reply Pat; I've added the code here to make it easier to edit as I haven't been able to get it to work sorry. There are no previous steps, this is a standalone column? Add Custom column wasn't coming up as an option? Sorry 🤔
let
Source = Table.AddColumn(#"Week Start", each Date.ToText(Date.StartOfWeek([Date], Day.Sunday),"MM/dd/yyyy"))
in
#"Week Start"- Hennadii6 years ago
Helper IV
CaveOfWonders , you mentioned you found this code somwhere online. Do you have a link?
- CaveOfWonders6 years ago
Helper IV
Sure Hennadii, the link is here:
https://community.powerbi.com/t5/Desktop/Week-Start-calculation/td-p/433890