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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dbrandone
Helper III
Helper III

Weird Dynamic Button Text Issue

So I have 4 buttons set up for page navigation within a report. 2 of the pages are Current Year Data and another is "Last Month". Instead of having Static text for the buttons as "Current Year" and "Last Month", I wanted the buttons to be dynamic with the text. I wrote the measures as:

Last Month Button Text =

     Calculate(
             Values('Date'[Month Name]),
             'Date'[Month Offset] = -1
           )

 

Current Year Button Text =

      Calculate(

              Values('Date'[Year]),

               'Date'[Year Offset] = 0

          )

 

The Last Month measure is not greyed out and works perfectly in the Button and shows November. The issue is the Current Year button as the measure is greyed out in the field value drop down. I have tried different measures for the current year, but all still have the measure greyed out and un-selectable. I have tried "Max" instead of "Values".

 

Does anyone know what could be causing this. I have made sure that the columns being filtered or used are in the correct format.

1 REPLY 1
ebeery
Solution Sage
Solution Sage

Hi @dbrandone, it appears from my testing that only Text columns/measures can be returned as button text.  In your case, "Month Name" is a text value, while "Year" is likely numeric.

You could try either converting Year to Text, or wrapping your "Current Year Button Text" in a FORMAT function like below:

Current Year Button Text =
FORMAT (
    CALCULATE ( VALUES ( 'Date'[Year] ), 'Date'[Year Offset] = 0 ),
    "General Number"
)

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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