DMN Decision Table Hit Policies Explained – With Clear Examples

 In DMN, Hit Policies define how the decision table evaluates rules and returns results.

Misunderstanding hit policies is one of the most common causes of wrong decision outcomes in production.

This blog explains:

  • What DMN Hit Policies are

  • All major hit policies (FIRST, UNIQUE, ANY, COLLECT, PRIORITY)

  • Real-world examples

  • Best practices (with Camunda DMN usage in mind)


1️⃣ What Is a DMN Hit Policy?

A Hit Policy defines:

  • How many rules can match

  • Which result is returned if multiple rules match

Without the correct hit policy:

  • Decisions may return unexpected values

  • Rules may conflict silently

  • Production logic may break


2️⃣ FIRST – First Matching Rule Wins

🔹 Behavior

  • Rules are evaluated top to bottom

  • The first matching rule is returned

  • Other matching rules are ignored

🧩 Example: Discount Calculation

Customer TypeDiscount
Premium20%
Regular10%

If customer = Premium20%

Use when:

  • Rules are ordered by priority

  • Only one result should be returned

Risk:

  • Wrong rule order = wrong decision


3️⃣ UNIQUE – Exactly One Rule Must Match

🔹 Behavior

  • Only one rule is allowed to match

  • If multiple rules match → error

  • If no rule matches → no result

🧩 Example: Tax Slab

Income RangeTax
0–50k5%
50k–100k10%

Only one slab can apply.

Use when:

  • Rules are mutually exclusive

  • Data quality is high

Risk:

  • Overlapping rules cause runtime errors


4️⃣ ANY – Multiple Matches Allowed, Same Result Required

🔹 Behavior

  • Multiple rules may match

  • All matched rules must return the same result

  • Otherwise → error

🧩 Example: Eligibility Check

ConditionEligible
Age > 18Yes
Country = EUYes

Multiple rules match → result is Yes

Use when:

  • Multiple conditions lead to the same outcome


5️⃣ COLLECT – Combine Results

🔹 Behavior

  • All matching rules are collected

  • Can be combined using:

    • COLLECT

    • COLLECT +

    • COLLECT <

    • COLLECT >

    • COLLECT #


🧩 Example: Risk Scoring (COLLECT +)

Risk FactorScore
High Debt40
Missed Payments30

Result = 70

Use when:

  • You need aggregated results (sum, min, max, count)


6️⃣ PRIORITY – Highest Priority Result Wins

🔹 Behavior

  • Multiple rules may match

  • Result with highest priority is returned

  • Priority defined by output value ordering

🧩 Example: Approval Level

ConditionLevel
Amount > 100kHIGH
Amount > 50kMEDIUM

Result = HIGH

Use when:

  • Business defines clear output priorities


7️⃣ Comparison Table (Quick Reference)

Hit PolicyMultiple MatchesResult Rule
FIRSTAllowedFirst match
UNIQUEExactly one
ANYAllowedSame result
COLLECTAllowedAggregated
PRIORITYAllowedHighest priority

8️⃣ Common Mistakes in Production

❌ Using FIRST without rule ordering
❌ Using UNIQUE with overlapping ranges
❌ Using ANY with different outputs
❌ Forgetting aggregation type in COLLECT
❌ Assuming PRIORITY without defining output order


9️⃣ Best Practices (Camunda DMN)

✅ Always document the chosen hit policy
✅ Test overlapping rules
✅ Prefer UNIQUE for clean business rules
✅ Use COLLECT for scoring models
✅ Validate decisions with real data
✅ Review DMN tables before production release


🔟 Interview Question (Bonus)

Q: Which hit policy should be used for scoring systems?
A: COLLECT (usually COLLECT +)

Q: Which hit policy throws an error on multiple matches?
A: UNIQUE


💼 Professional Support Available

If you face issues with DMN decision tables, wrong decision outcomes, or production decision errors, I provide paid consulting, DMN reviews, production debugging, and focused trainings.

📧 Contactishikhanirankari@gmail.com | info@realtechnologiesindia.com

🌐 WebsiteIT Trainings | Digital lectern | Digital rostrum | Digital metal podium 

Comments

Popular posts from this blog

jBPM Installation Guide: Step by Step Setup

Scopes of Signal in jBPM

OOPs Concepts in Java | English | Object Oriented Programming Explained