Forum Discussion
Dynamic format string - format
Hi, see if this helps.
For million example: #,0,,.00 M
# means shows a digit if needed that related to your measure after formatting
0 after #, means always show a digit here, minimal 0
The first comma (,) after # means use thousand separators
The 2 commas (,,) after #,0 is for scalling ie. 1 comma = divide by 1000, 2 commas = divide by 1000000
.00 after #,0,, is to show 2 decimal points
M at the end just to append the string M that correlated to division by 1000000 due to scaling
Examples:
so for 12 500 000
1- 12 500 000 / 1 000 000 = 12.5
2- use 2 decimal points = 12.50
3- add M = 12.50M
result > 12.50 M (thousand separator not used)
for 1 112 500 000
1- 1 112 500 000 / 1 000 000 = 1112.5
2- use 2 decimal points = 1112.50
3- add M = 1112.50 M
4- use thousand separator = 1,112.50 M
results > 1,112.50 M (thousand separator is used)
Here is a good example that you can try:
https://www.sqlbi.com/articles/introducing-dynamic-format-strings-for-dax-measures/
Here is where you can see example for more format options (not just "#,0.00 K" etc):
https://learn.microsoft.com/en-us/dax/format-function-dax