Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
tarun16feb
Regular Visitor

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

1 ACCEPTED SOLUTION

Hi @tarun16feb,

 

It seems no green arrow in unichar. Maybe you can try to format the column. Please refer to Power-BI-Desktop-DAX-Using-Unicode-Arrows-as-Measures-in-a-Tabl.

Measure =
IF ( MIN ( 'Table1'[Column1] ) < 600, UNICHAR ( 9650 ), UNICHAR ( 128315 ) )

Embedding_up_and_down_arrows_in_visual_and_changing_them_based_on_condition2

 

 

Best Regards,

Dale

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

View solution in original post

14 REPLIES 14
theov
Advocate II
Advocate II

This video explains this very well:)

https://www.youtube.com/watch?v=vv1RUpgodoE

dillonfarrar
Advocate I
Advocate I

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. 

dillonfarrar_1-1671053400277.png

 

Final Result within card: 

dillonfarrar_0-1671053325141.png

 

 

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

This worked perfectly for me, thanks you!

KevinMorneault
Helper II
Helper II

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 

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. 

dillonfarrar_2-1671053511645.png

 

 

Final Result within card: 

dillonfarrar_3-1671053511898.png

 

 

 

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

dillonfarrar_4-1671053511657.png

 

 

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

 

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.
Formatting.PNG
You will get arrow and color formatting according to your filters. And It's dynamic. 
 
This is how the arrows will look:
 
 

Arrows.PNG

I hope this helps.

 

Thanks,

Pragati Sidana

 

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

Anonymous
Not applicable

Glad I was of any help!!

v-jiascu-msft
Employee
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

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

Hi

 

Thanks for getting back. 

 

I am looking for an upward triangle with green color and downward triangle with red color.

 

I couldn't find the colored ones. Can you please point me in the right direction.

 

Hi @tarun16feb,

 

It seems no green arrow in unichar. Maybe you can try to format the column. Please refer to Power-BI-Desktop-DAX-Using-Unicode-Arrows-as-Measures-in-a-Tabl.

Measure =
IF ( MIN ( 'Table1'[Column1] ) < 600, UNICHAR ( 9650 ), UNICHAR ( 128315 ) )

Embedding_up_and_down_arrows_in_visual_and_changing_them_based_on_condition2

 

 

Best Regards,

Dale

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

We cannot really say that Green up Arrow problem is solved because even if you give green color default in formatting and give condition to change it to RED COLOR Arrow in measure calculation, when you pin that tile/table to Dashboard it won't take Green color which is defaulted in formatting. 

Dashboard can only accept colored Arrows/symbol which are given through measures. 

Formatted to Green color in reportFormatted to Green color in report

Dashboard shows like thisDashboard shows like this

Is there any formatting techniques Power BI has for Dashboards?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.