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
boa
Helper I
Helper I

Dynamic title with months if it is not a complete year

Hello,

 

I'm working with dynamic titles for the first time and I'm wondering if it is possible to:

1. display only the year in the title if the data of the year is complete

2. display the months or last month with data if the data of the year is not complete

 

I have now a dynamic title that shows the year that is selected. For 2019, 2020 and 2021 this is perfect.

 

boa_0-1668905092883.png

But for 2022 I would like to have 'jan - oct 2022' or '01/01/2022 - 31/10/2020' or something like that that indicates that the year is not complete.

boa_1-1668905221208.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @boa ,

I created some data:

vyangliumsft_0-1669021388396.png

Here are the steps you can follow:

1. Create measure.

Flag =
var _select=SELECTEDVALUE('Table'[Date].[Year])
var _mindate=
MINX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))),[Date])
var _maxdate=
MAXX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))),[Date])
return
IF(
    _select=2022,
    _mindate &"-"& _maxdate,
    _select&""&"")

2. Visualizations – Title – Text –fx.

vyangliumsft_1-1669021388397.png

 

vyangliumsft_2-1669021388398.png

3. Result:

Select 2021:

vyangliumsft_3-1669021388399.png

Select 2022:

vyangliumsft_4-1669021388400.png

 

Best Regards,

Liu Yang

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

3 REPLIES 3
Anonymous
Not applicable

Hi  @boa ,

I created some data:

vyangliumsft_0-1669021388396.png

Here are the steps you can follow:

1. Create measure.

Flag =
var _select=SELECTEDVALUE('Table'[Date].[Year])
var _mindate=
MINX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))),[Date])
var _maxdate=
MAXX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))),[Date])
return
IF(
    _select=2022,
    _mindate &"-"& _maxdate,
    _select&""&"")

2. Visualizations – Title – Text –fx.

vyangliumsft_1-1669021388397.png

 

vyangliumsft_2-1669021388398.png

3. Result:

Select 2021:

vyangliumsft_3-1669021388399.png

Select 2022:

vyangliumsft_4-1669021388400.png

 

Best Regards,

Liu Yang

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

FreemanZ
Super User
Super User
Jayee
Responsive Resident
Responsive Resident

Hi @boa 

 

Try below measure and adjust the field names according to your dataset

 

Title = if( selected value ( 'table'[year])=year(today()), min(date) && " - " && max(date), max(year))

 

If this post helps, then please consider Accept it as the solution, Appreciate your Kudos!!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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