Forum Discussion

UncleLewis's avatar
UncleLewis
Responsive Resident
3 years ago

Return Formatted Number As A Value

Hi all,

How can I return a Formatted Number as a value instead of text?
I tried wrapping Format() inside Value() but that returns an error.

//Format Numbers
Formatted Result =
VAR __Amount = 'Table'[Dollar Amount]
Return
SWITCH(
TRUE(),
__Amount < 1000, FORMAT( __Amount,"$###" ),
__Amount < 1000000, FORMAT( __Amount,"$#,.0K" ),
__Amount < 1000000000, FORMAT( __Amount,"$#,,.00M" ),
__Amount < 1000000000000, FORMAT( __Amount,"$#,,,.0B" )
)

 

Thanks,

-w

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    UncleLewis You can't with the FORMAT command. That's the purpose of Custom Format Strings but those aren't going to allow that much logic.