Forum Discussion

dpc_development's avatar
dpc_development
Helper III
4 years ago
Solved

Custom Format String based on measure value

In Excel, we can format a cell using the following style...   [>=1000000000]#,##0.00,,,"B";[>=1000000]#,##0.00,,"M";##,##0   So, if the value is below a million, it shows the full number, and f...
  • OwenAuger's avatar
    4 years ago

    Hi dpc_development 

    It sounds like a Calculation Group to control your number formatting would be useful here.

     

    With a Calculation Group, each Calculation Item has a format string specified by a DAX expression. This format string can be either a constant, or some expression that depends on the measure value itself.

     

    In your case, you may want to consider using the Calculation Group to act as the measure selector, as you could have each Calculation Item specify both the measure and the format string.

     

    Here's a good article on this general topic:

    https://exceleratorbi.com.au/dynamic-formatting-of-switch-measures/

     

    Calculation Groups do work with models containing DirectQuery tables, so this approach should work fine in your situation.

     

    Regards,

    Owen