visual calculation
18 TopicsUnlimited Visuals in one chart
Here’s the short “recipe” you can reuse to get unlimited visuals inside one chart. Define patterns, not visuals: -Create a small Selection table with one row per pattern: Selection ID and Selection Name (e.g. “Sales Drivers (2 bars + 2 lines)”, “Profit Engine”, “Pattern 27”, etc.). -Use this table as a slicer. Fix your KPI set -Decide a finite set of base KPIs (Sales, Cost, Profit, Units, Products, etc.). -Create normal measures for each KPI. -Create “router” Visual Calculations -For each KPI and for each role (Bar or Line), create one Visual Calculation that simply says: IF( SelectedID is in the list of patterns where this KPI should appear in this role, then show the KPI, otherwise BLANK ). Example: VC Sales (Bar) = IF( SelectedID IN {1,4,6}, [Total Sales], BLANK() ) -Wire the visual once -Put all Bar VCs in the Column Y-axis. -Put all Line VCs in the Line Y-axis. -You never touch the axes again. To add a new visual pattern later Add one row to the Selection table. Update the IN {…} lists in the affected Visual Calculations. Result One combo chart that can morph into any number of visual layouts (6, 20, 60, 100+) just by changing the selection. By Hadi Kheireddine LinkedIn17KViews1like2CommentsLorenz Curve
IN this post I demonstrate how to plot Lorenz Curve using VC IMPORTANT NOTE: you will need to "sort by ascending sales and compute the cumulative %" in M query , then drag this cumulative % ( and name it LorenzX) to the viusal instead of dragging product name or id , this is mandatory since the scale should be from 0 to 100% example : example result: "When the bottom 40% of products are included, they contribute about 21.4% of total sales." "Overall sales inequality is low inequality (Gini = 0.27)." BY Hadi Kheireddine1.3KViews0likes0CommentsReusable analytics curve
S-Curve (Logistic Growth): https://community.fabric.microsoft.com/t5/Visual-Calculations-Gallery/S-Curve/m-p/4890395#M15 ABC Classification Curve: https://community.fabric.microsoft.com/t5/Visual-Calculations-Gallery/ABC-Classification/m-p/4890397#M16 Pareto 80/20 Curve: https://community.fabric.microsoft.com/t5/Visual-Calculations-Gallery/Pareto-80-20/m-p/4890399#M17 Learning / Experience Curve: https://community.fabric.microsoft.com/t5/Visual-Calculations-Gallery/Learning-experience-curve/m-p/4890400#M18 Lorenz Curve: https://community.fabric.microsoft.com/t5/Visual-Calculations-Gallery/Lorenz-Curve/td-p/4883165 BY Hadi Kheireddine23KViews1like0CommentsLearning/experience curve
example: Plan assumes unit cost falls about 6% whenever volume doubles (LR=0.94), ending near 3.50 per unit (65% reduction). Actual data shows about 17% per doubling (LR=0.83), from 1,000 to 128,000 units, ending at 2.70 (73% reduction) — roughly 2.8× faster learning than plan. BY Hadi Kheireddine1.4KViews0likes0CommentsGeneric Outlier Detector
Generic Outlier Detector using VC -You don’t need to change the visual or drag KPIs into it. Just: -Add your KPIs to the KPI_Selection table -Point [Selected KPI Value] to the right KPI -Reuse the same outlier logic on any visual and data Outlier detection (per selected KPI over the visual’s rows) Is Outlier → returns Yes/No depending on which method is selected in the slicer. Outlier Severity → measures how far a value is beyond the chosen fence, scaled to 0–1 (0 = not outside, 1 = extremely far). The setup is modular: -You can add more rules, change thresholds or switch to one-sided detection without changing the overall structure. -Just manage your KPIs in KPI_Selection, map them in [Selected KPI Value], adjust the rules to your domain, and reuse the same framework everywhere. By Hadi Kheireddine LinkedIn1.2KViews0likes0CommentsThreshold 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 🔗LinkedIn2.3KViews0likes0CommentsIntroducing new Dynamic Multi-Level Ranking & Hierarchy Percentages with Visual Calculations
Dynamic Multi-Level Ranking & Hierarchy Percentages with Visual Calculations This visual demonstrates a fully dynamic Matrix analysis built entirely with Visual Calculations. It supports a multi-level hierarchy (Region → Country → City → Store) and automatically adapts as the user drills up or down. A Selected Metric field parameter drives all Visual Calculations. All rankings, percentages, and totals dynamically recalculate based on the user’s chosen metric (for example: Value or Row Count). A lightweight Level Label identifies the current row depth (Region, Country, City, Store) using ISINSCOPE. Each ranking VC returns a value only when the Matrix is at the correct level: Rank All – ranking across the entire visual Rank in Region – shown only at the Country level Rank in Country – shown only at the City level Rank in City – shown only at the Store level All ranks are formatted using FORMAT() for a clean whole-number display inside the Matrix. (If you want to apply conditional formatting, remove the FORMAT wrapper inside the VC.) You can extend the hierarchy to any number of levels by following the exact same pattern. The model also includes hierarchical percentage calculations: Share of Parent – contribution to the immediate parent node, using COLLAPSE Share of Total – contribution to the entire dataset, using COLLAPSEALL Both percentage measures are formatted with “0.00%” for clear readability. Visual Calculation functions used: RANK, ORDERBY, PARTITIONBY, COLLAPSE, COLLAPSEALL, FORMAT, DIVIDE This pattern provides a clean, dynamic, drill-aware analytical matrix that can be extended further in future posts. By Hadi Kheireddine Have fun exploring Visual Calculations! 🔗LinkedIn1.4KViews0likes0Comments