Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
i have a Sales table that has dates in a column, 4/15/2015, etc. I just wanted to show the Years. I thought I could just make a new measure and use a formula similiar to this...
years = YEAR('Sales Table' [dates])i dont even get the table/column names with Intellisense... why cant I do something like this in PBI? Whats the proper way? a short explanation would be appreciated.
Solved! Go to Solution.
Hi @ilcaa72,
YEAR function expect a single date in datetime or text format, containing the year you want to find.
You can get:
YEAR(LASTDATE('Sales Table' [dates]))or
YEAR(FIRSTDATE(Calendar[Date]))
To obtain the list of years you can mark the field as Date Hierarchy and select only the years
Regards.
Hey,
if you create a calculated column in your sales table you can use the function you already have. The benefit of creating a calculated column over a measure is that you can use the calculated column as a slicer. The price you pay, is an additional memory footprint, depending on the number of rows in your sales table.
I would recomment that you consider to create a separate date table and relate this table with your sales table. Here you will find some date related calculations that heavily rely on the usage of a separate date table: https://www.daxpatterns.com/time-patterns/
By the way, intellisense recognizes that the context expects an aggregate function, for this reason it does suggest a tablename. This behavior often reminds me that I should check my syntax and the context 🙂
Hope this what you are looking for
Regards
Tom
Hey,
if you create a calculated column in your sales table you can use the function you already have. The benefit of creating a calculated column over a measure is that you can use the calculated column as a slicer. The price you pay, is an additional memory footprint, depending on the number of rows in your sales table.
I would recomment that you consider to create a separate date table and relate this table with your sales table. Here you will find some date related calculations that heavily rely on the usage of a separate date table: https://www.daxpatterns.com/time-patterns/
By the way, intellisense recognizes that the context expects an aggregate function, for this reason it does suggest a tablename. This behavior often reminds me that I should check my syntax and the context 🙂
Hope this what you are looking for
Regards
Tom
Hi @ilcaa72,
YEAR function expect a single date in datetime or text format, containing the year you want to find.
You can get:
YEAR(LASTDATE('Sales Table' [dates]))or
YEAR(FIRSTDATE(Calendar[Date]))
To obtain the list of years you can mark the field as Date Hierarchy and select only the years
Regards.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.