Forum Discussion

Composed_MS's avatar
Composed_MS
Helper I
3 years ago
Solved

Color change for specific text in card visual

Hello,

 

I need to change the color of specific text in the card visual, as you can see below 2.8% is increased that's why it's green and 210bps is decreased hence red.

 

 

This whole line I am writing in measure and then putting it in card visual. 

Is it possible to color code only that many parts (2.8% and 210bps) in the card?

  • Hi Composed_MS 

    When faced with these situations, I tend to reach for a simple solution that just works.
    Uses a text box to combine two cards and apply conditional formatting rules.
    As follows:

    1.The text box is prepared and places where cards will go. I just type a string of strings that will save me space for the cards according to their maximum character limit:

    2. Creating each card with its conditional format, white background and cleaning everything that takes up space, and changing the border padding to eliminate white spaces

     

    3.I attach the cards to the places I saved them once they are designed

     

    4. Grouping all created "construction"

    Link to sample file 

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

     

11 Replies

  • Hi Composed_MS 

    When faced with these situations, I tend to reach for a simple solution that just works.
    Uses a text box to combine two cards and apply conditional formatting rules.
    As follows:

    1.The text box is prepared and places where cards will go. I just type a string of strings that will save me space for the cards according to their maximum character limit:

    2. Creating each card with its conditional format, white background and cleaning everything that takes up space, and changing the border padding to eliminate white spaces

     

    3.I attach the cards to the places I saved them once they are designed

     

    4. Grouping all created "construction"

    Link to sample file 

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

     

    • Composed_MS's avatar
      Composed_MS
      Helper I

      Hello Ritaf1983 
      The issue with this one is I am having around 70 lines with above 50 numbers of green or red color in it.
      So making it will be a lot of rework.
      But thanks a lot for this much effort.

    • Arjun_reddy's avatar
      Arjun_reddy
      Helper I

      Hello Ritaf, 

       

      have a great day!
      I have used this solution when i got the color code work, but my client uphappy with this work, they are expecting the colors to text only when we add the values into text should reflect the colors dynamically, is there any alternate method, please share with me.

       

      Thanks,

      Arjun Reddy

      • AmiraBedh's avatar
        AmiraBedh
        Super User

        Maybe it is time to explain to your client that Power BI is a powerful tool to be exploited in a careful way.
        Good luck with that 🙂

  • Create a measure that calculates the desired value and includes the text with color coding. For example : 

    yourMeasure = SUM(yourTable[Column])
     
    In the "Conditional formatting" pane, choose the "Based on field value" option and select the measure you want to apply formatting to, in your case yourMeasure.
    Click on the "+" icon to add a formatting rule. In the "Value" field, enter the specific text you want to format.
    Choose the desired formatting options, such as font color, background color, or font style, for the selected value.
    • Composed_MS's avatar
      Composed_MS
      Helper I

      I am using the whole line as a single measure, which is dynamic according to selection.
      In measure, I wrote it using & operator so that my text gets concatenated.
      Increase and decrease are dynamic which I coded in the measure itself.
      So in that measure for these two numbers I need to color code and other words should remain black colored only. AmiraBedh 

      • AmiraBedh's avatar
        AmiraBedh
        Super User

        Can you please share your pbix file ? or at least the code of your measure?

  • I tried HTML visual for this and made the text colored using HTML code. It worked as well but the issue is that the visual is not supported to export.
    There's no free HTML visual, which is Power BI certified. We want users to export the page to pdf or ppt.

  • Same issue here. It'd be good to be able to use FORMAT()... I don't think the answer marked as a solution is the solution... Is a workaround, but not always usable...