Power BI Exchange

Please login or click SIGN UP FOR FREE to create your PowerBIUG account to join this user group.
Expand all | Collapse all

Dynamic Text Box

  • 1.  Dynamic Text Box

    Posted Jun 12, 2019 04:02 PM
    Hello! I am trying to create a dynamic text box that will completely change when I make different selections on a slicer tool. For example: I have a small qualitatative summary for the overall report as well as for each country which is broken out in a slicer. I know there is a way to embed dynamic measures into a text box, but is there a way to make the whole thing dynamic? Thanks!

    Kayla Evans
    Data Analyst

  • 2.  RE: Dynamic Text Box

    Bronze Contributor
    Posted Jun 13, 2019 02:59 AM
    Probably easier to store the texts outside of your PBIX, in a SharePoint list or a spreadsheet.

    Set things up so you can create a relationship between the slicer value and the text.

    Donal McCarthy
    Digital Marketing Administrator

  • 3.  RE: Dynamic Text Box

    Top Contributor
    Posted Jun 13, 2019 04:16 AM
    Edited by Vishesh Jain Jun 13, 2019 04:18 AM
    Hi @Kayla Evans,

    You can use the card visual and display a measure on it.

    You can create a measure like:

    Text = IF(
    "Total Sales of " & SELECTEDVALUE(Locations[Countries]) & " is " & Sum(Sheet2[Sales]),
    "Total Sales is " & Sum(Sheet2[Sales]))

    Here are the results:

    Please let us know, if this works or if you need something else.

    ***Edit: You don't need the CALCULATE function, a simple SUM() will work in the 'else' result.

    Thank you,

    Vishesh Jain
    VR Construction

  • 4.  RE: Dynamic Text Box

    Posted Jun 13, 2019 07:17 AM
    Hi Kayla,

    You may want to use the ISFILTERED DAX function to create the desired measure. See details here - https://docs.microsoft.com/en-us/dax/isfiltered-function-dax

    Below is an example of some code you can use to create the measure, where I will use CountrySel as the measure to get the selected country.

    CountrySel =
    IF (
    ISFILTERED ( yourtablename[countryfield] ),
    CONCATENATEX ( FILTERS ( yourtablename[countryfield] ), yourtablename[countryfield] , ", " ),

    (Note: the use of the comas is to cater for multiple selections.

    Then you can create another measure with a the actual text you ant to display. This second measure is what you will use to put into a card visualization to make it dynamic. See example of this code below:

    DynamicTextLabel = ("Summary Performace for " & [CountrySel])

    You now simply need to add the second measure created, DynamicTextLabel to your card visualization and the value for counrty would change based on the country or countries selected.

    Please let me know if thuis works for you.


    Omari Felix

  • 5.  RE: Dynamic Text Box

    Bronze Contributor
    Posted Jun 13, 2019 06:03 PM
    Hi Kayla, my method is similar to that of Vishesh but I thought I'd share it to give you another example. My example uses a drop-down slicer showing our Project Managers. The visual defaults to "Selected PMs" if no choice is selected, but lists the PMs name if it is. My measure is called "DynamicPM".

    DynamicPM = IF( HASONEVALUE( ProjectManager[EMPLOYID] ),
        VALUES ( ProjectManager[FRSTNAME] ) & " " & VALUES ( ProjectManager[LASTNAME] ),
        "Selected PMs")​
    No selection
    One selectionBest of luck!

    Dr. Belinda (Bea) Amaya
    Systems Analyst
    Custom Air Products and Services, Inc
    Houston TX