cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Helper II

## Dynamic Date Title

Hi,

I want to insert years as a title into a card. Like shown in the picture.

The last card "2022" is always this year. I did this with the formula "=NOW()"

Each year the title should change to the next year.
But I dont know how to set the title for the previous year and the title for two years ago.
Is there a formula, with which i can just say: "Give me this year minus 1 year ?

Best regards.

1 ACCEPTED SOLUTION
Frequent Visitor

If you want a date you a year ago you can create the following measure:

Date a Year Ago = DATE(YEAR(TODAY())-1,MONTH(TODAY()), DAY(TODAY()))
10 REPLIES 10
Anonymous
Not applicable

Hi @Nanaki,

Try using the PREVIOUSYEAR() function along with the YEAR().

Here's the documentation: PREVIOUSYEAR function (DAX) - DAX | Microsoft Docs

I hope it helps

Super User

@Nanaki ,measure or column as per need

This Year = year(Today())

Next Year = year(Today()) +1

Last Year = year(Today()) -1

Helper II

But I still get strangely 1905 for the last year.

Super User

@Nanaki  Can you share screen shot of your date column and check which data type it is.

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Helper II

In the first picture you can see the formula "today" with the today date.

And in the 2. picture with "year(today)" i get the year 1905.

Frequent Visitor

Hi @Nanaki,

13-7-1905 is the date value of number 2021. You can see this e.g. in Excel by changing the format into Short Date of a cell containing 2021.

I can reproduce the behaviour you experience when I create a new column instead of a measure

Defintions:

• Column Last Year = year(Today()) -1
• Last Year = year(Today()) -1

Solution is then to create a measure with that definition.

Helper II

But with that solution I wont get the year 2021 in a date format right? Only in a number format ?

Frequent Visitor

If you want a date you a year ago you can create the following measure:

Date a Year Ago = DATE(YEAR(TODAY())-1,MONTH(TODAY()), DAY(TODAY()))
Helper II

Awesome, this worked. Thank you very much to all of you!

Helper II

I dont have a column, I just have this formula. I created it manually as a measure and wanted to insert it into one card.

Announcements

#### Fabric certifications survey

Certification feedback opportunity for the community.

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors