Forum Discussion

Yazid's avatar
Yazid
Icon for Helper I rankHelper I
2 years ago
Solved

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:   I'm waiting (refresh...
  • Kaviraj11's avatar
    2 years ago

    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.
     

     

    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,