Ravindra BagaleCourses & study guides

13. DAX: Data Analysis Expressions

13.14 Text Functions

-- CONCATENATE joins exactly TWO values; use & for more
Store Label = CONCATENATE(DarkStore[Store Name], " – " & DarkStore[City])

Customer Label = Customer[Customer Name] & " (" & Customer[City] & ")"

Platform Code = LEFT(Orders[Order ID], 3)             -- "BLK"

Store Number = RIGHT(DarkStore[Store ID], 2)          -- "01"

City Code = MID(DarkStore[Store ID], 5, 3)            -- "PUN"

Name Length = LEN(Customer[Customer Name])

Clean Name = UPPER(TRIM(Customer[Customer Name]))

Short Month = FORMAT('Date'[Date], "MMM-YY")          -- "Mar-25"

Sales Text = "Total sales: ₹ " & FORMAT([Total Sales], "#,##0")

Under 10 Text = FORMAT([% Orders Delivered Under 10 Mins], "0.0%")

Category List = CONCATENATEX(VALUES(Product[Category]), Product[Category], ", ")

Other useful text functions: LOWER, SUBSTITUTE, REPLACE, SEARCH (not case-sensitive), FIND (case-sensitive), CONTAINSSTRING, VALUE (text to number).

FORMAT returns text

FORMAT converts a number into text. A measure that returns FORMAT output cannot be used as a number in charts and sorts alphabetically. Prefer the Format options in Measure tools (or dynamic format strings) for display formatting.

Ravindra Bagale's Tip

Friends, many students build row-level text columns in DAX (splitting names, cleaning codes) that belong in Power Query. Do row-level text work in Power Query, where it runs once at refresh and compresses better. Use DAX text functions mainly for labels and titles in measures. Clear?