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.
I am trying to create a column with a specific date (date only) using M-query.
this will be the report date. whereby i will calculate an aging to some other data.
I am not looking for today's date though.
for example, i want all the column to include the same date of 1-Dec-2017.
thanks in Advance
Solved! Go to Solution.
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
Thank you so much. Appreciate the quick help!
If your problem has been resolved, please help accept solution. Your contribution is highly appreciated.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
81 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |