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 7 days ago
    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
    Houston
    8325571986
    ------------------------------
    Power Summit (bi) - Post


  • 2.  RE: Dynamic Text Box

    Bronze Contributor
    Posted 6 days ago
    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
    BrightWork
    Galway
    ------------------------------

    Power Summit (bi) - Post


  • 3.  RE: Dynamic Text Box

    Top Contributor
    Posted 6 days ago
    Edited by Vishesh Jain 6 days ago
    Hi @Kayla Evans,

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

    You can create a measure like:

    Text = IF(
    ISFILTERED(Locations[Countries]),
    "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
    Owner
    VR Construction
    ------------------------------

    Power Summit (bi) - Post


  • 4.  RE: Dynamic Text Box

    Posted 6 days ago
    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] , ", " ),
    "All"
    )

    (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.

    ------------------------------
    Omari Felix
    000000
    +18684725983
    ------------------------------

    Power Summit (bi) - Post


  • 5.  RE: Dynamic Text Box

    Bronze Contributor
    Posted 6 days ago
    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
    7134609009
    ------------------------------

    Power Summit (bi) - Post