How To Use New Visual Calculation In Power Bi







How to Use New Visual Calculation in Power BI: Simulator & Guide


How to Use New Visual Calculation in Power BI

Interactive Visual Calculation Logic Simulator


Visual Calculation Logic Simulator

Simulate how functions like RUNNINGSUM and MOVINGAVERAGE process dataset rows without complex DAX measures.


Please enter a positive sales amount.
The base sales value for the first month.


Please enter a valid percentage (can be negative).
Simulated month-over-month growth to generate dataset.


Number of rows in the visual matrix.


Select the DAX Visual Calculation function to simulate.


Final Calculated Value (Last Row)

$0.00

Formula Used: RUNNINGSUM([Sales Amount])

Total Raw Sales

$0.00

Average Raw Sales

$0.00

Calc Impact Factor

0%

Simulated Output: Raw Data vs Visual Calculation Result


Month Raw Sales Calculated Result

What is “How to Use New Visual Calculation in Power BI”?

Understanding how to use new visual calculation in Power BI is transforming the way data analysts approach DAX. Visual calculations are a DAX capability that allows you to define calculations directly on the visual itself, rather than in the semantic model. This means you can create calculations that refer to columns, measures, or other visual calculations already present in the matrix or chart.

Traditionally, calculating a running total or moving average required writing complex DAX measures that handled filter context transitions. Visual calculations simplify this by operating on the data grid that the visual has already generated. This feature is ideal for analysts who need quick, report-specific calculations without cluttering the main data model with one-off measures.

However, a common misconception is that visual calculations replace all standard measures. While powerful for visual-specific logic like “Percent of Parent” or “Ranking within Visual,” standard measures are still best for reusability across multiple pages and reports.

Visual Calculation Formulas and Syntax

When learning how to use new visual calculation in Power BI, you will encounter specific functions designed to traverse the visual matrix. Unlike standard DAX which aggregates over the data model, these functions traverse the “visual matrix” (the rows and columns rendered on screen).

Function Purpose Typical Syntax Use Case
RUNNINGSUM Calculates a cumulative total along an axis. RUNNINGSUM([Sales]) Year-to-date sales or lifetime customer value.
MOVINGAVERAGE Computes an average over a specified window. MOVINGAVERAGE([Sales], 3) Smoothing out volatility in monthly revenue.
PREVIOUS References the value of the previous row. [Sales] - PREVIOUS([Sales]) Month-over-month growth (MoM) variance.
COLLAPSE Calculation at a higher level of hierarchy. COLLAPSE([Sales]) Seeing category totals while viewing sub-categories.

How the Simulation Works

The simulator above mimics these functions using JavaScript logic:

  • Running Sum: Accumulates the value of the current row plus all previous rows.
  • Moving Average: Takes the average of the current row and the previous N-1 rows (e.g., 3-month window).
  • Previous Difference: Subtracts the previous row’s value from the current row to find the net change.

Practical Examples of Visual Calculations

Example 1: Cumulative Sales Analysis

Scenario: A Sales Manager wants to see the total revenue accumulated throughout the fiscal year to track progress against an annual quota.

  • Raw Input: Monthly sales varying between $10,000 and $15,000.
  • Visual Calculation: RUNNINGSUM([Total Sales])
  • Output Interpretation: In Month 1, the result equals Month 1 sales. In Month 12, the result is the sum of all 12 months. This allows the manager to see the “climb” towards the goal without creating a complex CALCULATE(SUM(), DATESYTD()) measure.

Example 2: Smoothing Volatility with Moving Averages

Scenario: A retail store sees huge spikes in sales on weekends, making trend analysis difficult.

  • Raw Input: Daily sales data with high variance (spikes and drops).
  • Visual Calculation: MOVINGAVERAGE([Sales], 7)
  • Output Interpretation: The visual calculation creates a line chart that represents the 7-day average. This “smooths” the line, revealing the underlying growth or decline trend irrespective of daily noise.

How to Use This Visual Calculation Simulator

  1. Set Baseline Data: Enter a “Starting Monthly Sales” figure and a “Growth Rate” to generate a realistic dataset. This mimics the raw data coming from your Power BI semantic model.
  2. Select Time Period: Choose the number of rows (months) to simulate the matrix size.
  3. Choose Calculation Type:
    • Select RUNNINGSUM to see accumulation.
    • Select MOVINGAVERAGE to see trend smoothing.
    • Select PREVIOUS to see variance analysis.
  4. Analyze Results: Look at the “Final Calculated Value” and the Chart. The chart visually demonstrates the relationship between the raw data (Blue Line) and the Visual Calculation (Green Line).
  5. Copy Data: Use the “Copy Results” button to paste the logic assumptions into your documentation or notes.

Key Factors That Affect Visual Calculation Results

When mastering how to use new visual calculation in Power BI, consider these six critical factors:

  1. Visual Matrix Structure: Visual calculations depend entirely on what is on the visual. If you remove a “Month” column from the table, the RUNNINGSUM logic breaks or changes context immediately.
  2. Sort Order: Unlike model measures, visual calculations rely on the visual sort order. Sorting a table by “Sales Amount” instead of “Date” will change the result of a PREVIOUS function completely.
  3. Filter Context: Standard slicers affect the data loaded into the visual, and the calculation runs after those filters are applied.
  4. Query Performance: Generally, visual calculations are fast because they run on the small aggregated result set, not the millions of rows in the database.
  5. Hiding Columns: You can create a visual calculation and then “hide” the columns used to calculate it from the view, keeping the visual clean while retaining the logic.
  6. Maintenance Overhead: While easy to create, having logic scattered across dozens of individual visuals can be harder to audit than centralized measures in the model.

Frequently Asked Questions (FAQ)

1. Can I use visual calculations in other visuals?

No. Visual calculations are scoped strictly to the specific visual where they are created. You cannot drag a visual calculation from one chart to another.

2. Do visual calculations slow down the report?

Usually, they improve performance compared to complex DAX measures because they operate on a much smaller dataset (the aggregated visual data) rather than scanning the entire data model.

3. How do I export visual calculations?

When you export the visual’s data to CSV/Excel using “Export Data,” the results of the visual calculations are included as columns.

4. Can I reference a visual calculation in a standard measure?

No. Standard measures (Model DAX) are calculated before visual calculations. The dependency goes Model -> Visual, not the other way around.

5. What happens if I change the sort order?

Functions like RUNNINGSUM and PREVIOUS are relative to the visual position. If you change the sort order, the calculation values will recalculate based on the new order.

6. Is this feature available in Power BI Desktop and Service?

Yes, provided you have enabled the preview feature (if still in preview) or are on a version where it is generally available (GA).

7. Can I format visual calculations differently?

Yes, you can apply specific formatting strings or conditional formatting to the visual calculation column just like any other field.

8. Are visual calculations better than calculated columns?

They serve different purposes. Calculated columns increase model size and are static. Visual calculations are dynamic, do not increase model size, and exist only at the report layer.

© 2023 Power BI Analytics Tools. All rights reserved. Not affiliated with Microsoft.


Leave a Comment