Forum Discussion

Rosario's avatar
Rosario
Helper I
3 years ago
Solved

Thumbs Up & Down Conditional

Hi, can someone please help me? I want to add a green thumb Up, or red thumb Down according to the result in the column “Diff Count 2 vs Count 1, based on the column “Items” value. I have inserted th...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Rosario ,

     

    Here I suggest you to try to add svg in icon conditonal formatting in Power BI.

    Sample Code:

     

    Arrow = 
    // Variables to store arrow paths
    var uparrow = "<path d='M10 90 L50 10 L90 90 Z' fill='green' />"
    var downarrow = "<path d='M10 10 L50 90 L90 10 Z' fill='red' />"
    
    // Select arrow to use
    var arrow = IF([Diff Count 2 vs Count 1]>=0,uparrow,downarrow)
    
    // Insert arrow into SVG
    var svg ="data&colon;image/svg+xml;utf8," &
             "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>"
                & arrow & 
             "</svg>"
    
    RETURN svg

     

    Save the picture of Thumbs Up & Down from Power Point to your PC and then open them in Visual studio to get the path. We just need to change the path in above code from Arrow Up & Down to Thumbs Up & Down.

    You can refer to this video ( Using SVG in Power BI ) to learn more details. The author will show you a sample with a Squirrel icon. You should watch it from 21:00.

     

    Best Regards,
    Rico Zhou

     

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