DAX code
Selected Format =
SWITCH(
SELECTEDVALUE('Format Options'[Format]),
"Currency", "$#,##0",
"Percentage", "0.0%",
"Whole Number", "#,##0",
"$#,##0"
)
Switches a measure's display format (currency, percentage, whole number) based on a slicer selection, using Power BI's dynamic format strings.
Type your table and column names once. Every measure below updates.
Selected Format =
SWITCH(
SELECTEDVALUE('Format Options'[Format]),
"Currency", "$#,##0",
"Percentage", "0.0%",
"Whole Number", "#,##0",
"$#,##0"
)
Set this measure as the Total Sales measure's dynamic format string (right-click the measure > Format > fx, bind to a measure) rather than calling it directly.
Browse all 175 measures in the Power BI DAX Measures Library, or search the library for something similar to Dynamic Format String.