cancel
Showing results for 
Search instead for 
Did you mean: 
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
Super User
Super User

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
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors