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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
MCacc
Helper IV
Helper IV

Dynamic title from filter selection

Hello, 

 

I need to create a measure for a title to be put on a visual. 

 

The titel shows the values selected from a filter. 

 

The filter to be used is a Date format, a year to be exact.

 

The title should work in the following way:

- If the user selects one year, the title shows the year selected:

       2022 selected --> 2022 in the title

- If the user selected two years, the filter shows two years:

      2022 and 2023 selected --> 2022 and 2023 in the title

- If the user selects more than two years, they wanna see the MINIMUM and MAXIMUM year selected:

      2022, 2023, 2024, 2025 selected --> 2022 and 2025 in the title

 

Any idea how to achieve this?

 

Thank you very much

1 ACCEPTED SOLUTION
Bifinity_75
Solution Sage
Solution Sage

Hi @MCacc , try this:

- Create this measure:

Max_date = 
VAR MaxValue =
    CALCULATE ( MAX( Table1[Date].[Año] ), ALL(Table1[Date].[Año]))
RETURN
    CONCATENATEX (
        FILTER ( Table1, Table1[Date].[Año] = MaxValue ),
        MaxValue,
        " - "
    )

- Create this measure:

Min_date = 
VAR MinValue =
    CALCULATE ( MIN ( Table1[Date].[Año] ), ALL(Table1[Date].[Año]))
RETURN
    CONCATENATEX (
        FILTER ( Table1, Table1[Date].[Año] = MinValue ),
        MinValue,
        " - "
    )

 

- And last measure:

Result Selection = 
Var _count= COUNTROWS(VALUES(Table1[Date]))
return
IF (_count>2,[Min_date] & " - " & [Max_date], 
    CONCATENATEX(Table1,Table1[Date].[Año],"-")
    )

 

- The result:

Bifinity_75_0-1667936739347.png

 

I hope works it for you, best regards

 

 

 

View solution in original post

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @MCacc ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

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

Bifinity_75
Solution Sage
Solution Sage

Hi @MCacc , try this:

- Create this measure:

Max_date = 
VAR MaxValue =
    CALCULATE ( MAX( Table1[Date].[Año] ), ALL(Table1[Date].[Año]))
RETURN
    CONCATENATEX (
        FILTER ( Table1, Table1[Date].[Año] = MaxValue ),
        MaxValue,
        " - "
    )

- Create this measure:

Min_date = 
VAR MinValue =
    CALCULATE ( MIN ( Table1[Date].[Año] ), ALL(Table1[Date].[Año]))
RETURN
    CONCATENATEX (
        FILTER ( Table1, Table1[Date].[Año] = MinValue ),
        MinValue,
        " - "
    )

 

- And last measure:

Result Selection = 
Var _count= COUNTROWS(VALUES(Table1[Date]))
return
IF (_count>2,[Min_date] & " - " & [Max_date], 
    CONCATENATEX(Table1,Table1[Date].[Año],"-")
    )

 

- The result:

Bifinity_75_0-1667936739347.png

 

I hope works it for you, best regards

 

 

 

Thank you!!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.