Forum Discussion
Lable YTD Rows in Calendar
- 3 years ago
ShawnKeeneTF
The formula will return true for each of those dates.
Regards
The following M code generates all dates from 1st Jan 2020 to 31st Dec 2023 and uses the formula to mark each date as in YTD or not so you can check if it does what you want. The screenshot in your question was not readable so maybe there's some other subtlety in the question that it would reveal.
let
Source = List.Dates(#date(2020,1,1), Duration.TotalDays(#date(2023,12,31) - #date(2020,1,1)) + 1 , #duration(1,0,0,0)),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Date"}}),
#"Add in Year" = Table.AddColumn(
#"Renamed Columns",
"Error Free Version",
each Date.IsInYearToDate(
Date.AddYears( [Date], Date.Year(DateTime.LocalNow()) - Date.Year([Date]) )
),
type logical
)
in
#"Add in Year"
I found something like this online but I don't think this is exactly what I'm after. I'll give it a try though.
The problem is that I want for example June 1st to show up as true for all years. Basically all dates that are within the completed days this year.
So all these should be true for example
June 1 2020
June 1 2021
June 1 2022
June 1 2023
ShawnKeeneTF
The formula will return true for each of those dates.
Regards
The following M code generates all dates from 1st Jan 2020 to 31st Dec 2023 and uses the formula to mark each date as in YTD or not so you can check if it does what you want. The screenshot in your question was not readable so maybe there's some other subtlety in the question that it would reveal.
let
Source = List.Dates(#date(2020,1,1), Duration.TotalDays(#date(2023,12,31) - #date(2020,1,1)) + 1 , #duration(1,0,0,0)),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Date"}}),
#"Add in Year" = Table.AddColumn(
#"Renamed Columns",
"Error Free Version",
each Date.IsInYearToDate(
Date.AddYears( [Date], Date.Year(DateTime.LocalNow()) - Date.Year([Date]) )
),
type logical
)
in
#"Add in Year"