
I recently explored and used visual calculations in Power BI.
We may do DAX calculations that are declared and executed directly on a visual. Visual calculations make it easy to generate calculations that were previously difficult to do, resulting in simpler DAX, easier maintenance, and improved performance.
What is Visual Calculation in Power BI?
Visual calculations enable users to do new calculations using a simple interface based on a table of data, which is supported by sophisticated, easy-to-use formulae and Excel-like functionality.
The visual calculations are currently under preview. we can enable it from preview features
Files >> Options and Settings >> Options >> Preview features

Why is it important for Power BI?
Visual calculation is important in Power BI because it allows you to create more meaningful and interactive reports that can be used to make informed decisions. Without visual calculations, data can be overwhelming and difficult to interpret.
Visual Calculation in Practice:
Here’s one of the examples visual computations that creates a running total for Sales Amount: Below is the image with highlighted new calculation:


A calculation can relate to any data in the visual, such as columns, measurements, or other visual calculations, reducing the semantic model’s complexity and simplifying the DAX authoring process. Running sums and moving averages are two examples of popular business calculations that may be completed visually.
Running Total = RUNNINGSUM([Total Sales])

Given a table that summarizes the total sales for each product category and calendar month, the following DAX query adds a column with the average of total sales for that category for the previous six months:
Moving average = MOVINGAVERAGE([Total Sales], 6,ROWS)

Given the same table, the following DAX query adds a column containing the average of total sales for that category for the last 12 months (excluding the current month):

Visual calculations provide templates that make it easier to do routine calculations. To locate templates, click the template button and choose the template you want to work with.

Running sum: Calculates the sum of values by adding the current value to the previous ones. Uses the RUNNINGSUM function.
Moving average: Calculates the average of a series of values in a given window by dividing the total by the window’s size. Utilizes the MOVINGAVERAGE function.
percent of parent: Determines the proportion of a value compared to its parent. Utilizes the COLLAPSE function.

Percent of grand amount: The COLLAPSEALL function is used to calculate the percentage of a value in relation to all other values.

Average of children: calculates the average of the child’s values. Utilizes the EXPAND feature.

Versus previous: Using the preceding function, compares a value to one that came before it.

Versus next: Using the NEXT function, compare one number to the next.

Versus first: The FIRST function compares a value to the first value.

Versus last: Using the LAST function, compares a value the pastto its previous value.

Previous:
Description: On an axis, references the previous row in relation to the current one. In the base below, we get the value for the last row. Similarly, we used time intelligence to obtain MOM, QOQ, and YOY.

Axis
The Axis parameter influences how visual computations are conducted. This parameter is optional and controls the path taken by the visual computation across the visual matrix. By default, it aligns with the visual’s principal axis, which is often ROWS. This indicates that the calculation proceeds sequentially over each row in the matrix, from top to bottom. The Axis parameter can take many values, each of which indicates a particular computation direction:

Note: You may only utilize axis values that are included in the graphic you’re working on. Not all visuals include all axes, and some do not.
Hiding fields from the visual:
In visual calculations edit mode, you may conceal fields in the same way as you do in the modeling view. For example, if you just want to show the total sales and moving average for 12 months, you can hide the other calculations from view:

Benefits of Using Visual Calculation:
Visual calculations simplify DAX, making it easier for users to undertake complicated data analysis.
Easy to Create: Calculations are as simple as Excel, making them accessible to citizen coders.
Performance: Because computations are performed directly to the visual, they can improve performance, particularly when working with aggregated data.
versatility: Users may adjust computations to the data given in a graphic, providing unequaled analytical versatility.
Dynamic Interactivity: Visual computations react dynamically to user inputs in the report, allowing for real-time analytical changes.
Independent of Explicit Row Context: The visual computations do not rely on an explicit column or row axis. However, they may utilize the available axes to decrease the amount of computation required.
Limitations Using Visual Calculations:
Visual computations are presently under preview, and when previewing, you should be aware of the following factors and limitations:
Not every visual kind is supported. To modify the visual type, use the visual calculation edit mode. Additionally, bespoke graphics have not been tested with visual calculations or hidden fields.
The following visual kinds and visual characteristics were investigated and found to be incompatible with visual calculations or concealed fields:
- Line and stacked column chart
- Treemap
- Map
- Shape Map
- Azure Map
- Slicer
- R visual
- Python visual
- Key Influencers
- Decomposition Tree
- Q&A
- Smart Narrative
- Metrics
- Paginated Report
- ArcGIS Maps
- Power Apps
- Power Automate
- Small multiples
The performance of this feature is not reflective of the final product.
Visual computations cannot be reused using copy/paste or other means.
You cannot filter by visual calculations.
A visual computation cannot refer to itself at the same or different detail levels.
Visual computations and hidden fields cannot be customized.
You cannot utilize the Publish to Web capability with reports that contain visual computations or hidden fields.
Underlying data cannot be exported from visualizations that employ visual computations or concealed fields.
You cannot utilize the view records drill-through feature with graphics that contain visual computations or hidden data.
You cannot use built-in or custom format strings in visual computations.
Visual computations cannot be conditional format.
Visual computations do not allow you to specify data categories.

Conclusion:
Visual calculations are an important enhancement in Power BI’s capabilities, providing users with a powerful tool for dynamic and adaptable data analytics. By understanding and exploiting this capability, analysts may design reports that are more intuitive, interactive, and informative. As Power BI evolves, features such as visual calculations demonstrate the company’s dedication to making data analysis more accessible and powerful for professionals across sectors.
Happy Reading!!
Blog Reference: https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-visual-calculations-overview