Forum Discussion

bvy's avatar
bvy
Helper V
4 years ago
Solved

PBI - Button Label Ignoring Multiple Spaces

I have measures that are meant to generate labels inside of a Button control. I use the f(x) feature which allows me to choose the button text from my data model. So I might have something like this: 

 

_ButtonLabel = [DAX bla bla bla] & " - " & [DAX bla bla bla]

 

which works fine. But what I want is this: 

 

_ButtonLabel = [DAX bla bla bla] & "     -     " & [DAX bla bla bla]

 

See how I added FIVE spaces on either side of the hyphen? When the label text appears in my button, Power BI collapses all multiple instaces of the space back to one. So basically both expressions above give the same result. 

 

Does anyone see a workaround? I want the extra spaces for formatting. Thanks. 

4 Replies

  • bvy weird, maybe add nonprintable unichar characters instead of space.

     

     

    Follow us on LinkedIn and  to our YouTube channel

     

    Learn about conditional formatting at Microsoft Reactor

    My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

    • bvy's avatar
      bvy
      Helper V

      Yes that worked. UNICHAR(160) + UNICHAR(160) displays two spaces, whereas "  " and UNICHAR(32) + UNICHAR(32) collapses the spaces down to one instance. Thank you. 

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi bvy ,

     

    You can try like this:-

    Measure = 
    var _varA = [DAX bla bla bla]
    var _varB = [DAX bla bla bla]
    return CONCATENATE(CONCATENATE(_varA ,"     -     "), _varB)

     

    Thanks,

    Samarth

  • bvy good to know. cheers! Thanks for sharing.

     

     

     

    Follow us on LinkedIn and  to our YouTube channel

     

    Check my latest video on Filters and Sparklines https://youtu.be/wmwcX8HvNxc

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.