Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Yazid
Helper I
Helper I

Truncate a column based on a year

Dear,

I'd like to truncate my date colum as function of the year. Namely, i'd like to return a column but with the only date in 2024.

Here below the expected results:

Yazid_0-1718131213532.png

 

I'm waiting (refreshing the internet page) to your solution 😄 

1 ACCEPTED SOLUTION
Kaviraj11
Super User
Super User

Hi,

 

You will need to create a calculated column

 

New StartDate =
VAR _Year=YEAR(TODAY())
RETURN SWITCH(TRUE(), YEAR('Fact'[StartDate])=_Year,'Fact'[StartDate],BLANK())
 
You can replace the variable _Year with any condition or static value.
 
Kaviraj11_0-1718134946724.png

 

If you would like to display only date of that year, you can filter out the date when is blank in Filter pane as well.

 

Regards,

 
 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table with a relationship (Many to One and Single) from the Date column of your Fact Table to the Date column of the Calendar Table.  In the Calendar Table, create a calculated column of Year.  To a slicer, drag Year from the Calnedar Table and select 2024.  To your Table visual, drag Date from the Calendar Table. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Kaviraj11
Super User
Super User

Hi,

 

You will need to create a calculated column

 

New StartDate =
VAR _Year=YEAR(TODAY())
RETURN SWITCH(TRUE(), YEAR('Fact'[StartDate])=_Year,'Fact'[StartDate],BLANK())
 
You can replace the variable _Year with any condition or static value.
 
Kaviraj11_0-1718134946724.png

 

If you would like to display only date of that year, you can filter out the date when is blank in Filter pane as well.

 

Regards,

 
 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thanks a lot !

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors