Forum Discussion
Creating a measure that looks at two date columns
- 4 years ago
The latest date in your calendar table is 19-May-2020. The visual uses Year from the date hierarchy of Date. It's best practice to mark your calendar table as a date table (see link below). This will remove the automatic date hierarchy for each date field. You can create a calculated column for Year using the YEAR function.
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Many thanks for this - its looks like it could solve my issue (and many others). Unfortunately I cant replicate it exactly. I think the issue is I can`t create your Year Slicer. I have updated my calendar table to include 2021, however, when doing this the data for 2021 is not showing - although 2021 is now present in the table.
I`d really appreciate it if you could have a look for me.
Many thanks.
The latest date in your calendar table is 19-May-2020. The visual uses Year from the date hierarchy of Date. It's best practice to mark your calendar table as a date table (see link below). This will remove the automatic date hierarchy for each date field. You can create a calculated column for Year using the YEAR function.
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/