Component.Symbols
Get comparison symbol based on style and value sign. This component function returns appropriate directional symbols (arrows, triangles, etc.) for indicating positive, negative, or zero values in data comparisons.
Syntax
DaxLib.FormatString.Component.Symbols (
symbol_style,
value_type
)
Definition
DAX
// Get comparison symbol based on style and value sign
// Returns appropriate symbol for positive, negative, or zero values
(
// Symbol style - number (1-9) or text:
// 1 or "ARROWS": ↑/↓
// 2 or "TRIANGLES": ▲/▼
// 3 or "PLUSMINUS": +/-
// 4 or "CHEVRONS": ˄/˅
// 5 or "GREENRED": 🟢/🔴
// 6 or "BLUEORANGE": 🔵/🟠
// 7 or "BLOCKARROWS": ⬆/⬇
// 8 or "CHECKCROSS": ✓/✗
// 9 or "NONE": no symbol
symbol_style: ANYVAL,
// Value type: "POSITIVE", "NEGATIVE", or "ZERO"
value_type: STRING
)
=>
VAR _SymbolCode =
IF ( ISNUMBER ( symbol_style ),
symbol_style,
SWITCH ( UPPER ( symbol_style ),
"ARROWS", 1,
"TRIANGLES", 2,
"PLUSMINUS", 3,
"CHEVRONS", 4,
"GREENRED", 5,
"BLUEORANGE", 6,
"BLOCKARROWS", 7,
"CHECKCROSS", 8,
"NONE", 9,
9
)
)
VAR _Symbol =
SWITCH ( value_type,
"POSITIVE",
SWITCH ( _SymbolCode,
1, "↑",
2, "▲",
3, "+",
4, "˄",
5, "🟢",
6, "🔵",
7, "⬆",
8, "✓",
9, "",
""
),
"NEGATIVE",
SWITCH ( _SymbolCode,
1, "↓",
2, "▼",
3, "-",
4, "˅",
5, "🔴",
6, "🟠",
7, "⬇",
8, "✗",
9, "",
""
),
""
)
RETURN
_Symbol
Parameters
| Parameter | Type | Description |
|---|---|---|
symbol_style |
ANYVAL | Symbol style - number (1-9) or text code |
value_type |
STRING | "POSITIVE", "NEGATIVE", or "ZERO" |
Example
DaxLib.FormatString.Component.Symbols ( "ARROWS", "POSITIVE" )
Use this function to get directional symbols for comparison displays based on value type.
Related Functions
- RelativeToTarget.Percents - Uses symbols for percentage formatting
- RelativeToTarget.Numeric - Uses symbols for numeric formatting
- Component.MakeStringSafe - String safety for format strings