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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
agd50
Helper V
Helper V

Dynamic Title (Last year unless it's currently Q2 +)

How would you create a dynamic text that states to put the previous year if it's Q1?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @agd50 ,

 

We can create a measure.

Dynamic Year Title = 
VAR CurrentDate = TODAY()
VAR CurrentYear = YEAR(CurrentDate)
VAR CurrentQuarter = QUARTER(CurrentDate)
RETURN
IF(CurrentQuarter = 1, FORMAT(CurrentYear - 1, "0"), FORMAT(CurrentYear, "0"))

This formula checks the current date and determines the quarter. If it's the first quarter (Q1), the formula subtracts one year from the current year to display the previous year. Otherwise, it displays the current year.

 

Go to the visual where you want to display the dynamic title. In the "Format" pane, find the "Title" section. Click on the "fx" button to enable conditional formatting. Choose "Format by" as "Field value" and select the measure you created.

vtangjiemsft_0-1712561854032.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @agd50 ,

 

We can create a measure.

Dynamic Year Title = 
VAR CurrentDate = TODAY()
VAR CurrentYear = YEAR(CurrentDate)
VAR CurrentQuarter = QUARTER(CurrentDate)
RETURN
IF(CurrentQuarter = 1, FORMAT(CurrentYear - 1, "0"), FORMAT(CurrentYear, "0"))

This formula checks the current date and determines the quarter. If it's the first quarter (Q1), the formula subtracts one year from the current year to display the previous year. Otherwise, it displays the current year.

 

Go to the visual where you want to display the dynamic title. In the "Format" pane, find the "Title" section. Click on the "fx" button to enable conditional formatting. Choose "Format by" as "Field value" and select the measure you created.

vtangjiemsft_0-1712561854032.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

danextian
Super User
Super User


Please  provide a more detailed information. What does Q1 refer to? - today's date or the selected date in a slicer? Do you have separate dates table or you're using the fact table?





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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