Forum Discussion
year to date
- 8 years ago
Hi JP-Ronse,
To use the solution suggested by WolfBiber, you need to create a calendar table first, and create a one to many relationship between calendar table and your source table.
DateTime=CALENDAR(DATE(2015,1,1), DATE(2018,12,31))
By the way, all above functions are DAX functions which should be used in report view mode rather than Query Editor mode.
Regards,
Yuliana Gu
- 8 years ago
;) then use PowerBi Desktop, its for free
https://powerbi.microsoft.com/en-us/desktop/
and you can create date Tables in Excel 2016, don't know if in 2013 its also working
- 8 years ago
JP-Ronse You can create calendar table in PQ as well, here is link for that , I'm sure there are more.
https://www.powerquery.training/portfolio/dynamic-calendar-table/
JP-Ronse You can create calendar table in PQ as well, here is link for that , I'm sure there are more.
https://www.powerquery.training/portfolio/dynamic-calendar-table/
Hi All,
Thanks for all the feedback. I have to go back to school and that at my age (62) :smileyfrustrated:
There are a lot of interesting links in the replies I have to go through.
It is no really YTD but for now I keep it as:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"DAY", type datetime}, {"THRESHOLD", Int64.Type}, {"MIN_OCCURENCES", Int64.Type}, {"METRIC", type text}, {"RESOURCE_NAME", type text}, {"CONT_BREACHING_COUNT", Int64.Type}, {"SEPARATED_BREACHING_COUNT", Int64.Type}, {"islast<I1>months", type any}, {"12", type any}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each Date.IsInYearToDate([DAY]) or Date.IsInPreviousNMonths([DAY], 12)),
#"Split Column by Delimiter" = Table.SplitColumn(Table.TransformColumnTypes(#"Filtered Rows", {{"DAY", type text}}, "en-GB"),"DAY",Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv),{"DAY.1", "DAY.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"DAY.1", type date}, {"DAY.2", type time}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"DAY.2"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"DAY.1", "DAY"}}),
#"Filtered Rows1" = Table.SelectRows(#"Renamed Columns", each ([METRIC] = "UTILIN")),
#"Removed Columns1" = Table.RemoveColumns(#"Filtered Rows1",{"islast<I1>months", "12"})
in
#"Removed Columns1"Thanks all,
JP-Ronse