BIChart Logo
BIChart

Quick Table Calculations DAX Patterns

Migration

Summary

Tableau Table Calculations to Power BI DAX Patterns

1. Understanding Tableau Table Calculations

Table calculations in Tableau are post-aggregation formulas that compute values based on the layout of the visualization. They are commonly used for running totals, percent of total, moving averages, ranks, and other window-style results.

Key Features:

  • Functionality: Calculates across marks that are already in the view.
  • Scope Definition: Uses addressing and partitioning to define the calculation scope.
  • Dependence: Relies on the structure of the visual rather than just the raw data.

Usage Context:

  • Layer: Primarily used in the visualization layer.
  • Application: Applied after aggregation.

User Interaction:

  • Users typically add a table calculation to a measure, choose compute using or partitioning settings, and adjust sorting and layout to modify the result.

2. Purpose of Table Calculations

Table calculations exist to:

  • Compare each row to the rows preceding or surrounding it.
  • Display share, trend, and accumulation patterns.
  • Enable users to derive analytic insights without altering the source data.

3. Transitioning to Power BI

In Power BI, most table calculation behaviors are replicated using DAX measures that manipulate filter context. Unlike Tableau, where the visual directly defines the calculation, Power BI requires encoding the window logic within the measure.

Key Differences:

  • Tableau table calculations are driven by the visualization layout and compute direction.
  • Power BI typically necessitates explicit filter-context logic using functions like CALCULATE, ALL, ALLEXCEPT, FILTER, and iterators.

4. Equivalent Patterns in Power BI

#### Pattern A: Running Total

  • Tools Used: DAX measures, CALCULATE, FILTER, ALL, ALLSELECTED.
  • When to Use: For cumulative sales, cumulative counts, and progressive percentages.
  • Notes: This is the most common replacement for Tableau’s running total table calculations. Use ALLSELECTED when you want the total to respect slicers but ignore row-by-row visual context.

#### Pattern B: Percent of Total

  • Tools Used: DAX measures, DIVIDE, CALCULATE, ALL, ALLEXCEPT, ALLSELECTED.
  • When to Use: For share of category, contribution by segment, and percent of grand total.
  • Notes: Tableau often computes percent of total directly in the view, while in Power BI, the denominator must be defined explicitly with filter removal or preservation logic.

#### Pattern C: Window or Moving Calculation

  • Tools Used: DAX measures, AVERAGEX, SUMX, FILTER, DATEADD, DATESINPERIOD.
  • When to Use: For moving averages, rolling sums, period-over-period comparisons, and rank-like logic.
  • Notes: Power BI does not use Tableau-style addressing and partitioning. You define the window using date or index filters in DAX.

5. Implementation Examples

#### Tableau Example for Running Total
“`tableau
RUNNING_SUM(SUM([Sales]))
“`

#### Power BI Equivalent for Running Total
“`DAX
Running Total Sales =
CALCULATE(
SUM(Sales[Sales]),
FILTER(
ALLSELECTED(Sales[Date]),
Sales[Date] <= MAX(Sales[Date])
)
)
“`

#### Tableau Example for Percent of Total
“`tableau
SUM([Sales]) / TOTAL(SUM([Sales]))
“`

#### Power BI Equivalent for Percent of Total
“`DAX
Percent of Total Sales =
DIVIDE(
SUM(Sales[Sales]),
CALCULATE(
SUM(Sales[Sales]),
ALLSELECTED(Sales)
)
)
“`

#### Tableau Example for Moving Average
“`tableau
WINDOW_AVG(SUM([Sales]), -2, 0)
“`

#### Power BI Equivalent for Moving Average
“`DAX
3 Month Moving Average =
AVERAGEX(
DATESINPERIOD(
‘Date'[Date],
MAX(‘Date'[Date]),
-3,
MONTH
),
CALCULATE(SUM(Sales[Sales]))
)
“`

6. Recommended Approaches for Different Scenarios

Scenario Recommended Approach
Cumulative total across dates in a line chart Running Total measure with CALCULATE and FILTER
Share of category within the current visual Percent of Total measure using DIVIDE and filter removal
Rolling average over the last N periods Window-style measure using AVERAGEX and DATESINPERIOD
Ranking within a category or segment RANKX with explicit context control

7. Common Pitfalls to Avoid

  • Relying on Tableau-style compute directions instead of defining filter context in DAX.
  • Forgetting that ALL removes more context than intended.
  • Using ALL when ALLSELECTED is needed, which can cause slicers to be ignored.
  • Building window logic that depends on row order without a stable date or index column.
  • Expecting a measure to behave like a table calculation without specifying its partition logic.

8. Advanced Considerations

  • Utilize a proper Date table for time-based calculations.
  • Prefer measures over calculated columns for interactive analytic behavior.
  • Test whether the measure should respect slicers, page filters, or only visual-level filters.
  • For complex window logic, consider combining disconnected helper tables with DAX measures.
  • When translating from Tableau, first identify the intent: accumulation, normalization, ranking, or windowed comparison.

9. Summary of Key Points

Tableau table calculations are visualization-driven post-aggregations. In Power BI, these calculations are typically recreated using measures that explicitly control filter context.

Key Takeaway: Tableau table calculations translate to Power BI as DAX measures combined with filter context logic for running totals, percent of total, and window calculations.

Ready to migrate? Start today.

Join the growing number of companies that have simplified their Tableau to Fabric migration with BIChart.

Ryan Goodman

Ryan Goodman

Ryan Goodman has been in the business of data and analytics for 20 years as a practitioner, executive, and technology entrepreneur. Ryan recently returned to technology after 4 years working in small business lending as VP of Analytics and BI. There he implanted an analytics strategy and competency center for modern data stack, data sciences and governance. From his recent experiences as a customer and now working full time as a fractional CDO / analytics leader, Ryan joined BIChart as CMO.