Forum Discussion
Create a column with a specific date
- 8 years ago
If your problem has been resolved, please help accept solution. Your contribution is highly appreciated.
Looks like you need a parameter for your reference date.
No need to add a column with the reference date: you can use the parameter value to calculate the aging.
But you can still add a column with the reference date, though.
Both are included in this query:
let
Source = #table(type table[Date = date],List.Zip({List.Dates(#date(2017,1,1),20,#duration(15,0,0,0))})),
AddedAging = Table.AddColumn(Source, "Aging", each RefDate - [Date], type duration),
AddedRefDate = Table.AddColumn(AddedAging, "RefDate", each RefDate, type date)
in
AddedRefDate
- asdaifallah8 years agoNew Member
Thank you so much. Appreciate the quick help!
- v-chuncz-msft8 years agoCommunity Support
If your problem has been resolved, please help accept solution. Your contribution is highly appreciated.
- kkoons6683 years agoRegular Visitor
Hi,
I found another solution to throw in here.
You just add a custom column and have the value as "1", then when it shows in your table in the query editor, you change the data type from "number" to "date." This changes the "1" to "12/31/1899." Last step, replace values from "12/31/1899" to whatever your date is that you are wanting. Here's the M Query code:
#"Added Custom3" = Table.AddColumn(#"Grouped Rows", "Report Date", each 1),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom3",{{"Report Date", type date}}),
#"Replaced Value" = Table.ReplaceValue(#"Changed Type1",#date(1899, 12, 31),#date(2022, 11, 6),Replacer.ReplaceValue,{"Report Date"})Thanks