Prompt Details
Model
(claude-4-6-sonnet)
Token size
379
Example input
[TABLE NAME]: Orders
[COLUMN ONE]: ProductCategory
[COLUMN TWO]: SubCategory
[SEPARATOR]: |
Example output
// Example 1: Orders table — ProductCategory | SubCategory
// Table: Orders | Column One: ProductCategory | Column Two: SubCategory | Separator: " | "
Orders[Display Label] =
VAR vPartOne =
TRIM(Orders[ProductCategory])
// Trim whitespace from the first column value
VAR vPartTwo =
TRIM(Orders[SubCategory])
// Trim whitespace from the second column value
VAR vCleanOne =
IF(ISBLANK(vPartOne) || vPartOne = "", "", vPartOne)
// Return empty string if first part is blank, otherwise keep value
VAR vCleanTwo =
IF(ISBLANK(vPartTwo) || vPartTwo = "", "", vPartTwo)
// Return empty string if second part is blank, otherwise keep value
VAR vLabel =
SWITCH(
TRUE(),
vCleanOne <> "" && vCleanTwo <> "", vCleanOne & " | " & vCleanTwo,
// Both parts present: join with separator
vCleanOne <> "", vCleanOne,
// Only first part present: return it alone
vCleanTwo <> "", vCleanTwo,
// Only second part present: return it alone
BLANK()
// Neither part present: return blank
)
RETURN
vLabel
By purchasing this prompt, you agree to our terms of service
CLAUDE-4-6-SONNET
Tired of messy, blank-breaking label columns? This prompt generates a production-ready DAX calculated column that combines any two text columns into a clean, formatted display label — skipping blanks automatically and avoiding leading, trailing, or double separators. Works with any table or data model across any industry. No hardcoded values, no nested IFs. Just supply your table name, two column names, and your preferred separator, and get clean DAX instantly.
...more
Added 3 days ago
