Forum Discussion

miitch's avatar
miitch
Frequent Visitor
2 months ago
Solved

Table Call Value Formatting Options

In both the documentation in Learn as well as blog posts, I'll see text formatting that I cannot for the life of me find in either desktop or the service.  For example, in the sample images on this ...
  • danextian's avatar
    2 months ago

    Hi miitch 

    It looks like the contents of the Status column are DAX-generated SVG images as if they were background conditional formatting, they would have filled the entire cell and not just a portion of it. 

     

    Below is a sample measure I used in the status buttons above. This measure is to be categorized as an Image URL

    Status SVG Button = 
    VAR _Text = [Status Measure]
    
    VAR FillColor =
        SWITCH (
            [Status Measure],
            "Value A", "#ffb09c",
            "Value B", "DeepSkyBlue",
            "Value C", "#FFFFE5",
            "#D3D3D3"
        )
    
    VAR FontColor =
        SWITCH (
            [Status Measure],
            "Value A", "black",
            "Value B", "white",
            "black"
        )
    
    VAR StrokeWidth =
        IF ( [Status Measure] = "Value C", 2, 0 )
    
    VAR _SVG =
        "<svg xmlns='http://www.w3.org/2000/svg' width='200' height='70'>
            <rect 
                x='0' 
                y='5' 
                width='200' 
                height='56' 
                rx='10' 
                ry='10' 
                fill='" & FillColor & "' 
                stroke='#e5e500' 
                stroke-width='" & StrokeWidth & "' 
            />
            
            <text 
                x='100' 
                y='38' 
                font-size='30' 
                font-family='Arial' 
                fill='" & FontColor & "' 
                text-anchor='middle' 
                dominant-baseline='middle'>
                " & _Text & "
            </text>
        </svg>"
    
    RETURN
        IF (
            HASONEVALUE ( d_Dimension[Attribute] ),
            "data" & ":" & "image/svg+xml;utf8," & _SVG
        )