Forum Discussion

Gopiraju404's avatar
Gopiraju404
Frequent Visitor
1 year ago
Solved

How to Bold Specific Column Values in Power BI Table Visual.

Hi All, I’m working on a table visual in Power BI and need help with formatting. I want to bold all the values in the “Target” column of the table. Is there a way to apply this formatting directly t...
  • Bibiano_Geraldo's avatar
    Bibiano_Geraldo
    1 year ago

    Your Target column have numbers and texts, thats why its say's cannot convert text to int.
    Now i update the measure to include texts, please try it:

    BoldTarget = 
    VAR RawText = SELECTEDVALUE(financials[Country])
    RETURN
        IF (
            ISBLANK(RawText),
            BLANK(),
            VAR LengthOfText = LEN(RawText)
            VAR Chars =
                ADDCOLUMNS (
                    GENERATESERIES(1, LengthOfText, 1),
                    "@Char", MID(RawText, [Value], 1),
                    "@Code", UNICODE(MID(RawText, [Value], 1)),
                    "@BoldChar",
                        SWITCH (
                            TRUE(),
                            // Digits 0–9 → 𝟬–𝟵
                            UNICODE(MID(RawText, [Value], 1)) >= UNICODE("0") &&
                            UNICODE(MID(RawText, [Value], 1)) <= UNICODE("9"),
                                UNICHAR(UNICODE("𝟬") + UNICODE(MID(RawText, [Value], 1)) - UNICODE("0")),
    
                            // Uppercase A–Z → 𝗔–𝗭
                            UNICODE(MID(RawText, [Value], 1)) >= UNICODE("A") &&
                            UNICODE(MID(RawText, [Value], 1)) <= UNICODE("Z"),
                                UNICHAR(UNICODE("𝗔") + UNICODE(MID(RawText, [Value], 1)) - UNICODE("A")),
    
                            // Lowercase a–z → 𝗮–𝘇
                            UNICODE(MID(RawText, [Value], 1)) >= UNICODE("a") &&
                            UNICODE(MID(RawText, [Value], 1)) <= UNICODE("z"),
                                UNICHAR(UNICODE("𝗮") + UNICODE(MID(RawText, [Value], 1)) - UNICODE("a")),
    
                            // Percent sign
                            MID(RawText, [Value], 1) = "%", "%",
    
                            // Dot
                            MID(RawText, [Value], 1) = ".", "·",
    
                            // Hyphen
                            MID(RawText, [Value], 1) = "-", "-",
    
                            // Default: keep original
                            MID(RawText, [Value], 1)
                        )
                )
            RETURN
                CONCATENATEX (
                    Chars,
                    [@BoldChar],
                    "",
                    [Value],
                    ASC
                )
        )
    

     

    Just assign your value to RawText  variable, but make sure that is correctly formatted.

     

    Thank you