To start, to access the Custom Formatting box, simply right click a Metric and choose Formatting -> Values. Under the Number tab, Custom is the last option in the list.
This text box can hold a Custom Formatting String that will apply to the values in the metric. You can embed some basic logic into it, and it follows the same syntax of Microsoft Excel's Custom Formatting syntax. For more some good documentation on the different things you can do, check out Microsofts article on the subject:
http://office.microsoft.com/en-us/excel-help/create-or-delete-a-custom-number-format-HP001216503.aspx
One particular use case that I wanted to highlight was a requirement to show values as 3.5K instead of 3,500 and 4.6M instead of 4,600,000 in a Graph's axis. At first I attempted to solve this with Conditional Formatting (and was successful), but unfortunately that formatting didn't carry over into the Graph's Axis. A colleague of mine found the above linked Custom Formatting document and managed to craft this handy Format:
[>=1000000]#.#0,,"M";[>=1000]#.#0,"K";0To break it down, you can think of this String as a Case statement with 3 possibilities, each separated by a semicolon.
[>=1000000]#.#0,,"M"
[>=1000]#.#0,"K"
0
Within the first 2 statements, the condition within the brackets gives the condition that we're catching, in this case, when the value is a million or a thousand. The formatting string #.#0, tells it that we want to format it as a number (#) with a decimal point (.) that includes 0 instead of rounding it off (0) and separate larger numbers with commas (,). Finally, we append some free text within the double quotes to denote M or K. The final 0 simply catches the formatting for the 0 value.
Sample data from MicroStrategy Tutorial
Ultimately, this solution worked great and we were able to meet the requirement of formatting the Graph Axis in this manner. In our case, this was a proof of concept for a complicated report that we ended up doing in Flash Builder, but we do still have some old exported PDFs that we emailed to users that showed it was working. I mention this, because when I tried to reproduce it again for the purposes of this post, I was not able to. It seems others in a forum post asking about this feature today (which jogged my memory that we had done this and lead to this post) also had similar issues. Not only was I not able to reproduce it in a Graph, but in Web the format string didn't even work in a Grid. I've reached out to MicroStrategy Technical Support, and will update this post when a workaround is discovered or a patch is released.
In the meantime, mastering the Custom Format String can open a lot of opportunities for meeting requirements and making your numbers look a little better. Just don't try to use them in a Graph Axis ... yet.



I wish i had known this before. Spent a lot of time for one of our custom formatting requirement, and finally we had to do it at the database side. Referred to help doc, but was not helpful... many thanks for sharing this!!
ReplyDeleteIt's not working for million, but it is working for thousand.
ReplyDeleteOrginalValue FormattedValue
10000 10.0K
1000000 100.0M (Which is incorrect)
There was a typo in the code. It's two commas for M, one comma for K.
DeleteHi Bryan,
ReplyDeleteIt is nice solution.
Could you please explain me for this line "and separate larger numbers with commas (,). "
If possible thn please provide small example.
Thanks,
Prince
There's a link there that goes into Microsoft's documentation that has very in depth details, but for this one:
Delete"A comma that follows a digit placeholder scales the number by 1,000. For example, if the format is #.0,, and you type 12,200,000 in the cell, the number 12.2 is displayed."
Hi Bryan,
ReplyDeleteThank you for your reply.
Thanks,
Prince
Hi Bryan,
ReplyDeleteIt is a greate solution.
But as for the Graph Axis, it works for single axis, when it comes to dual axis, for example, Y1 for Revenue and Y2 for Revenue Mix(%), then the "$" or "K" or "M" will not show as expected.
Any idea and way to fix it?
Thanks,
Hello ,
ReplyDeleteI'm able to bring K or M on the report but failed to bring the dynamics units (K or M ) on graph.Can any one throw some light on this
Thanks
Hi,
ReplyDeleteThe above formatting when applied in Grid's can be visible, but when tried to apply the same formatting in Dashboards, we are not able to see that effect.
In dashboarding do we need to do any additional operations to achieve this?
Where are you trying to apply it? I commonly use it on text boxes and it works fine.
DeleteHi Bryan,
Deleteas per your comments i did the change on Text Box but its not applying, when i check in report its working fine, please let me know any other way where we can achieve this-thanks
Srikanth