Search code examples
powerbidaxpowerbi-desktop

custom formating in DAX


I need to add green down arrow and red upper arrowin my dax code. it seems to me there is no UNICHAR option in here. many thanks in advance.

   Dumbell_Change% = 
VAR _value = DIVIDE( [Current Week Amt], [Previous Week Amt] ) - 1 

VAR diffs = 
SWITCH(
    TRUE(), 
    _value < 0,
    UNICHAR(9660), BLANK())

//VAR _label = FORMAT( _value, "↑ 0%;🠋 0%" ) //‏‏‎ ‎
// ⇧ 🠋 "🠉 0%; ⇩ 0%"

VAR Result = FORMAT(_value, "Percent") & " " & diffs
RETURN Result

lets assume my debt has been decreased based on the previous (arrow down green)

  current   previous current - previous change  change percentage 
    100     80             20             0.25   25 % arrow up red 
    100     125           -25            -0.2   -20 % arrow down green 

Solution

  • You need to go to format and conditional formatting, select Icons for the field you want to set conditional formatting on, and then set the Icons as ON.

    enter image description here

    and you have a plenty of icons, including the green down arrow and red upper arrow :

    enter image description here