Forum Discussion

tarun16feb's avatar
tarun16feb
Regular Visitor
8 years ago
Solved

Embedding up and down arrows in visual and changing them based on condition

Hi

 

I need to add an up and down arrow image to my report which displays the arrow based on specific condition.

 

I have created a new measure show_image where

      show_image  = if sum(sales) > 1000 then 'Image url of up arrow' else 'Image url of down arrow'

 

The problem with this approach is that it returns the url of the image but I cannot format a measure to display the image URL. It can only be done with columns. 

and If i use a column then it returns me both the URL. 

 

Now is there a way to display just one result based on the condition.

 

Any help would be appreciated.

Thanks

14 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi tarun16feb

     

    Here is the solution I discovered, 

    use UNICHAR(9650) for up arrow and 

    UNICHAR(9660) for a down arrow. 
     
    Then make measure using dax:
    YOY rev Arrow = var Red = UNICHAR(9660)
    var Green = UNICHAR(9650)
    return
    if( [% growth Revenue]>0, Green, Red)
     
    YOY rev Arrow, measure will give you up arrow when growth revenue is greater than 0 and down arrow when growth revenue is less than 0. But there is no color formatting yet. But the size of the arrows is same unlike some solutions mentioned above. 
     
    Now for adding color formatting, green and red create another measure.
    My condition was to have Green arrow up where growth is positive and red arrow down where growth is negative.
    So, i made one measure using DAX:
     
    YOY rev Arrow Condition =
    if( [% growth Revenue]>0, 1,0)
     
    Now pull the YOY rev Arrow measure into a KPI visual.
    We will do color formatting in the KPI only.
     
    Go to column format >> Data label >> add conditional formatting to the color of the data label
    Select YOY rev Arrow Condition measure for applying rules
     
     
    Add rules, Green where value is 1 and Red where value is 0.
    You will get arrow and color formatting according to your filters. And It's dynamic. 
     
    This is how the arrows will look:
     
     

    I hope this helps.

     

    Thanks,

    Pragati Sidana

     
    • ashlibek's avatar
      ashlibek
      Icon for Advocate I rankAdvocate I

      Thank you so much, I've been searching all day for this, Thank you!!

      • Anonymous's avatar
        Anonymous
        Not applicable

        Glad I was of any help!!

  • Anonymous's avatar
    Anonymous
    Not applicable

    There are a few ways you can do this but the way I currently do this is based on the following: 

    1) Growth % Measure: %YoY = Divide(([CYTD] - [PYTD]),([PYTD]))


    2) Secondary Measure for Icons included within the %YOY: 
    YOY%Icons  =
    VAR Arrow =
    SWITCH (
    TRUE (),
    [%YoY] < 0, UNICHAR ( 8659 ),
    [%YoY] = 0, UNICHAR ( 8660 ),
    [%YoY] > 0, UNICHAR ( 8657 )
    )
    RETURN
    FORMAT ( [%YoY], "Percent" ) & " " & Arrow

     

    3) Create conditional formatting on that column or card.

     

    If >0 then green, if <0 then red. 

     

    Final Result within card: 

     

     

    Please like this message if this helped you figure out a viable solution to your issue. 🙂 

    • Anonymous's avatar
      Anonymous
      Not applicable

      This worked perfectly for me, thanks you!

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi tarun16feb,

     

    Maybe you can use unichar instead. You can try it like this. You can find out more arrows here.

    Measure =
    IF ( MIN ( 'Table2'[Column1] ) < 600, UNICHAR ( 11014 ), UNICHAR ( 11015 ) )

    Embedding_up_and_down_arrows_in_visual_and_changing_them_based_on_condition

     

    Best Regards,

    Dale

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi.

     

    Please follow the steps below.

     

    - in the Values section, expand the options for the field you want the arrows.

    - click Conditional formatting

    - select Icons

    - select the Style (the type of icon you want)

    - set the rules

     

    And you are done. 🙂

     

    Let me know if this helps.

     

    Thanks

    Rohtashv

     

  • Hi  everyone

    I have the same situation but comparing weeks so basically its on a card and the number is showing a week but the arrow would compare with previous week. if this week number is higher then up and vice versa. this is the measure we created but dont know how to include the up and down arrow.

     

    UpDownArrow1 = IF( [Week2 Hrs]>0,(([Week1 Hrs]-[Week2 Hrs])/[Week2 Hrs]),UNICHAR(9650),UNICHAR(9660))
     
    can someone have an suggestion 
    • Anonymous's avatar
      Anonymous
      Not applicable

      There are a few ways you can do this but the way I currently do this is based on the following: 

      1) Growth % Measure: %YoY = Divide(([CYTD] - [PYTD]),([PYTD]))


      2) Secondary Measure for Icons included within the %YOY: 
      YOY%Icons  =
      VAR Arrow =
      SWITCH (
      TRUE (),
      [%YoY] < 0, UNICHAR ( 8659 ),
      [%YoY] = 0, UNICHAR ( 8660 ),
      [%YoY] > 0, UNICHAR ( 8657 )
      )
      RETURN
      FORMAT ( [%YoY], "Percent" ) & " " & Arrow

       

      3) Create conditional formatting on that column or card.

       

      If >0 then green, if <0 then red. 

       

       

      Final Result within card: 

       

       

       

      Please like this message if this helped you figure out a viable solution to your issue.