Forum Discussion
How can I create a same time last year column in Query Editor?
- 9 years ago
The Query Editor does not use DAX syntax. Instead it uses the "Power Query Formula Language", also called "M" or "PQL".
Here's the link to it's formula doco:
https://msdn.microsoft.com/library/mt253322?ui=en-US&rs=en-US&ad=US
For your scenario, I would try something like this in your Custom Column:
= Date.AddYears ( [Datetime] , -1 )
Then to use that to "Lookup" the previous value, I would use a Merge to the same query - it should show as Table1 (Current). In the Merge definition, if your Custom Column is callend Datetime -1Y, then I would choose that column in the top table and Datetime in the bottom Table1 (Current).
Then I would expand the Value column from the resulting NewColumn. The Expand button will be in the table header row, just to the right of NewColumn.
The Query Editor does not use DAX syntax. Instead it uses the "Power Query Formula Language", also called "M" or "PQL".
Here's the link to it's formula doco:
https://msdn.microsoft.com/library/mt253322?ui=en-US&rs=en-US&ad=US
For your scenario, I would try something like this in your Custom Column:
= Date.AddYears ( [Datetime] , -1 )
Then to use that to "Lookup" the previous value, I would use a Merge to the same query - it should show as Table1 (Current). In the Merge definition, if your Custom Column is callend Datetime -1Y, then I would choose that column in the top table and Datetime in the bottom Table1 (Current).
Then I would expand the Value column from the resulting NewColumn. The Expand button will be in the table header row, just to the right of NewColumn.
Thanks Mike, that pointed me in the right direction!