gopy6243's avatar
gopy6243
Advocate IV
9 months ago

Threshold Classification + Mode-Driven N-Bar / N-Line Activation using Visual Calculations

 

 

 

Visual Calculations: Threshold Classification + Mode-Driven N-Bar / N-Line Activation

This pattern demonstrates how threshold-based classification can be combined with a mode selector to dynamically activate or deactivate multiple KPIs inside a single visual.
The example showcases Sales and Cost (dual activation and Combo mode), but the same technique scales naturally to N KPIs — where any number of bars or lines can be enabled, disabled, or combined based on user selection.
The entire behavior is implemented fully inside Visual Calculations, requiring no additional model measures and no complex DAX branching.


Concept Overview

This solution is built on two simple but powerful Visual Calculation ideas.


1. Threshold Classification

Users define two numeric field parameters:

  • Threshold Min
  • Threshold Max

Each row is then classified as:

  • Inside Threshold → value falls within user-selected limits
  • Outside Threshold → value is lower or higher than the defined range

This classification can later drive color (done in this example, red outside , green inside), size, filtering, or custom business logic — all within the visual.


2. Mode-Driven N-KPI Activation

A field parameter allows users to select which KPI(s) the visual should display:

  • Single KPI Mode (e.g., Sales only)
  • Another KPI Mode (e.g., Cost only)
  • Combo Mode (e.g., Sales + Cost)
  • Extendable N-Mode (Sales + Cost + Margin + Volume + …)

The logic works by activating or hiding each KPI’s bar/line depending on the selected mode.
With the same pattern, you can scale from 2 KPIs to 10+ KPIs, simply by extending the selector.


How the Visual Behaves

  • Threshold classification applies instantly to the selected KPI
  • Switching the mode updates which bars/lines appear
  • Combo mode overlays multiple KPIs in a single visual
  • The structure remains clean and requires no duplicated visuals
  • Everything is responsive and slicer-aware

This gives one visual the flexibility of many, reducing clutter and improving user experience.


Visual Calculation Functions Used

The following explicit Visual Calculation functions and operations were used:

  • IF()
  • IN { }
  • BLANK()
  • Logical comparisons
  • Direct measure references within the VC grid

Pros

  • A single visual behaves as multiple dynamic KPI modes (display N KPI visuals as single visual)
  • Threshold logic is user-controlled and instant
  • Easily extendable to N KPIs
  • Avoids complex DAX and additional model measures
  • 100% implemented using Visual Calculations

Cons

  • Threshold logic is tied to one metric (Sales) unless expanded
  • More KPIs mean more mode combinations to configure visually ( update the code of VisualType Table , and selectedmode measure )

Future Post Enhancements Pattern

Potential extensions:

  • Make the threshold parameter in a bigger unit of scale to decrease number of rows
  • Multi-KPI threshold classification
  • Multi-zone thresholds (Warning, Critical, Optimal)
  • Dynamically generated KPI lists (user chooses which KPIs appear)
  • Additional Conditional formatting using VC per KPI
  • Automatic scaling for N KPIs without manual repetition

By Hadi Kheireddine

🔗LinkedIn

No RepliesBe the first to reply