Text and conversion
Keep identifiers and measures in their proper types
DAX text functions build readable labels and inspect strings. A conversion function changes the representation into another type. Product identifiers are not amounts: converting 0012 to a number loses the leading zeros and may collapse distinct identifiers. FORMAT produces text, so it should not replace the numeric measure used on a chart axis.
Use the isolated Import table ScalarSales from labs/dax-scalar-functions/scalar-sales.csv. In Power Query, explicitly set LineID, Region, ProductCode, ProductName and UnitsText to Text; RevenueUSD to Fixed Decimal Number. Empty RevenueUSD fields must be null, not zero or text. Model culture: en-US; no relationships or RLS. Each row is a synthetic sale-line observation, including two observations with unreported revenue. Currency is USD; no taxes or returns. All results are expected, not native execution evidence. Run each EVALUATE query separately in DAX Query View without report slicers. For a measure or calculated column, create each named definition separately in the appropriate model editor.
Example 1 — Labels and case-insensitive search
EVALUATESELECTCOLUMNS( ScalarSales, "Line", ScalarSales[LineID], "Label", ScalarSales[ProductCode] & " | " & ScalarSales[ProductName], "LampPosition", SEARCH("lamp", ScalarSales[ProductName], 1, 0))ORDER BY [Line]| Line | Label | LampPosition |
|---|---|---|
| S01 | 0012 | Desk Lamp | 6 |
| S02 | 0012 | Desk Lamp | 6 |
| S03 | 0120 | Notebook | 0 |
| S04 | 0120 | Notebook | 0 |
| S05 | 0030 | Floor LAMP | 7 |
| S06 | 0030 | Floor LAMP | 7 |
| S07 | 0100 | Cable | 0 |
The & operator joins text, as does CONCATENATE for two arguments. SEARCH uses a one-based starting position and is case-insensitive; a supplied not-found value of zero prevents a missing match from raising an error. Zero is not a valid character position. SEARCH supports wildcards, so do not assume arbitrary user-provided patterns are literal; use reviewed literal search terms here. This query emits labels but does not alter keys in the model.
Example 2 — Convert numeric text but keep numeric measures
EVALUATEROW( "Numeric", VALUE("0012"), "Text ID", "0012", "Label", CONCATENATE("SKU-", "0012"), "Display", FORMAT(219.99, "0.00", "en-US"), "Number", 219.99, "Invalid", IFERROR(VALUE("oops"), BLANK()))Expected values: numeric 12, text 0012, text SKU-0012, text 219.99, numeric 219.99, BLANK. The two displayed 219.99 values have different types. A numeric measure remains suitable for totals and continuous axes; a FORMAT result does not. VALUE uses recognized number/date formats and can fail on invalid or mixed text. Parse incoming values in Power Query with an explicit culture and audit rejects, rather than applying a numeric conversion indiscriminately to an entire dirty column.
Format at the presentation layer
Create Reported Revenue = SUM(ScalarSales[RevenueUSD]) as a numeric measure. Assign a model format string for USD, or use a dynamic format string when supported by the selected Desktop/model. A dynamic format expression returns a format pattern while the measure remains numeric; it does not exchange currencies or rescale data automatically. For this USD-only fixture a static format is sufficient. FORMAT uses its own documented format conventions; specify locale when stable output matters. Dynamic format strings depend on host/model capabilities; exact version and remote-model restrictions must be checked. Avoid sorting formatted amounts as strings or joining tables by display labels.
Practice — Predict label and type
For S05, predict the label and lamp position. Explain why ProductCode 0030 must remain text. Compare VALUE("0030") and FORMAT(30,"0000","en-US"): record each result and data type. Decide whether a revenue chart should use the formatted text or the original numeric measure.
Official reading
CONCATENATE · SEARCH · VALUE · FORMAT · dynamic formats · types