SELECTEDMEASUREFORMATSTRING DAX Function (Information)

Returns format string for the measure that is currently being evaluated.

Syntax

SELECTEDMEASUREFORMATSTRING ( )

This expression has no parameters.

Return values

Scalar A single string value.

Format string of the measure currently being evaluated – which is the measure identified by SELECTEDMEASURE.

» 3 related articles

Examples

-- Format string expression for Thousands calculation item
-- in Scale calculation group, which is used in the following example:
VAR CurrentFormatString =
    SELECTEDMEASUREFORMATSTRING ()
VAR FormatStringContainsDot =
    SEARCH ( ".", CurrentFormatString, 1, 0 ) > 0
VAR Result =
    CurrentFormatString & IF ( NOT FormatStringContainsDot, ".00" ) & " K"
RETURN
    Result
--  SELECTEDMEASUREFORMATSTRING returns the format string of the 
--  selected measure. It can be used only in calculation items
--
--  Its main usage is to dynamically create a format string based on
--  the original format string, modified by the calculation item
EVALUATE
SUMMARIZECOLUMNS (
    'Date'[Calendar Year],
    'Scale'[Scale],
    TREATAS ( { "CY 2009" }, 'Date'[Calendar Year] ),
    "Amount", [Sales Amount],
    "Format String", IGNORE('Sales'[_Sales Amount FormatString] )
)
ORDER BY
    'Date'[Calendar Year]
Calendar Year Scale Amount Format String
2009-01-01 Value 9,353,814.87 #,0.00
2009-01-01 Thousands 9,353.81 #,0.00 K
2009-01-01 Millions 9.35 #,0.00 M

Related articles

Learn more about SELECTEDMEASUREFORMATSTRING in the following articles:

Last update: Sep 12, 2021   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/selectedmeasureformatstring-function-dax

2018-2021 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of SELECTEDMEASUREFORMATSTRING? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.