Power BI (DAX) Guide · Prompt: “Classify DealSize into Enterprise (>=50000), Mid-Market (>=15000), or SMB using DAX SWITCH(TRUE())”

Clean Multi-Tier Segmentation Using DAX SWITCH(TRUE())

Verified by LiveFormulaLab Engineering Team • Updated November 2026

Replace messy nested IF statements in Power BI with clean, readable DAX SWITCH(TRUE(), ...) segmentation logic and live sample outputs.

Verified Power BI (DAX) Syntax

SWITCH(TRUE(), [Total Revenue] >= 50000, "Enterprise", [Total Revenue] >= 15000, "Mid-Market", "SMB")

How This Formula Works (Step-by-Step)

Writing four nested IF() blocks in DAX quickly becomes unreadable. SWITCH(TRUE(), ...) acts like a clean SQL CASE WHEN statement.

Step 1: Passing TRUE() as the first argument tells SWITCH to return the value of the first condition that evaluates to true.

Step 2: Always order thresholds from highest to lowest (>= 50000 before >= 15000) and supply a final fallback label ("SMB").

Formula Syntax & Arguments Breakdown

Evaluates ordered boolean threshold conditions sequentially inside SWITCH(TRUE(), ...) and returns the first matching tier label or fallback default.

Argument / ClauseRequirementData TypeRole & Behavior
expression (TRUE())RequiredConstant BooleanTells SWITCH to match the very first condition expression that evaluates to TRUE.
valueN & resultN ([Total Revenue] >= 50000, "Enterprise")RequiredCondition & LabelBoolean comparison paired with its tier string, numeric score, or hex color code.
else ("SMB")OptionalDefault ValueFallback label returned when none of the ordered thresholds match.

3 Real-World Use Cases

  • Assigning dynamic Platinum / Gold / Silver customer tiers based on trailing spend.
  • Bucketing aging invoices into 0-30, 31-60, and 60+ Days Past Due.
  • Color-coding Power BI KPI cards dynamically with hex colors inside SWITCH(TRUE()).

Cross-Platform Equivalents

Excel
=IFS(B2>=50000,"Enterprise",B2>=15000,"Mid-Market",TRUE,"SMB")
SQL
SELECT CASE WHEN revenue >= 50000 THEN 'Enterprise' WHEN revenue >= 15000 THEN 'Mid-Market' ELSE 'SMB' END AS tier FROM accounts;
Python Pandas
np.select([df['Revenue']>=50000, df['Revenue']>=15000], ['Enterprise','Mid-Market'], default='SMB')
Power BI (DAX)
SWITCH(TRUE(), [Total Revenue] >= 50000, "Enterprise", [Total Revenue] >= 15000, "Mid-Market", "SMB")

Common Mistakes & Pro Tips

Pitfalls & How to Fix Them

  • Mistake: Placing lower thresholds before higher ones (>= 15000 before >= 50000) misclassifies $75,000 deals into Mid-Market.

    Fix: Always order descending conditions strictly from highest threshold down to lowest.

  • Mistake: Omitting the final fallback ("SMB") causes unmatched edge values to return BLANK() silently.

    Fix: Always include a catch-all default value as the final odd argument.

  • Mistake: Trying to use a measure-driven SWITCH(TRUE()) on a chart Axis fails—measures can only return values, not slicer/axis buckets.

    Fix: Use a calculated column for static axis tiers, or a disconnected Parameter/Tier table with a measure for dynamic grouping.

Engineering Pro Tips

  • Use SWITCH(TRUE()) inside Conditional Formatting rules to return hex color codes like "#10B981" or "#EF4444".
  • Cache expensive threshold measures in a VAR amt = [Total Revenue] at the top of the formula before calling SWITCH(TRUE(), ...).
  • Replaces 5+ nested IF() blocks cleanly with zero syntax clutter.

Frequently Asked Questions

Why must conditions be ordered from largest to smallest?
SWITCH stops at the very first TRUE match. If >= 15000 came first, a $75,000 deal would match >= 15000 and be mislabeled Mid-Market.
Can SWITCH return measures or hex color codes instead of text?
Yes. Power BI conditional formatting frequently uses SWITCH(TRUE(), [Margin] >= 0.3, "#10B981", "#EF4444").
Does SWITCH evaluate remaining branches after finding a match?
No, DAX short-circuits SWITCH branches cleanly once a matching TRUE condition is found.

Related Formulas & Guides