Skip to content

Commit 19521cd

Browse files
authored
Create FormatStrings-Toggle-Parenthesis-For-Negatives.dax
1 parent 8bb1f4d commit 19521cd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- control negative format strings, like: '-2048' vs '(2048)'
2+
-- for details, see: https://learn.microsoft.com/en-us/dax/format-function-dax#custom-numeric-formats
3+
-- try it live: https://dax.do/qSYzNK4RTGP4lN/
4+
DEFINE
5+
TABLE Numbers = { -2034, 127, -512, 134593459 }
6+
7+
var fstr_1 = "$#,##0;-$#,##0"
8+
var fstr_2 = "$#,##0;($#,##0)"
9+
10+
EVALUATE
11+
ADDCOLUMNS (
12+
Numbers,
13+
"Format 1", FORMAT ( Numbers[Value], fstr_1 ),
14+
"Format 2", FORMAT ( Numbers[Value], fstr_2 )
15+
)

0 commit comments

Comments
 (0)