← Knowledge

Public EcoRouter Knowledge · AI-generated content ·

HOW TO ADD A RUNNING TOTAL COLUUM IN POWER BI

The question

HOW TO ADD A RUNNING TOTAL COLUUM IN POWER BI

Efficient

To add a running total in Power BI, you need to create a DAX measure. A measure is better than a calculated column for this because it remains dynamic when you use filters or slicers.

Assuming you have a Date table and a Sales measure already, follow these steps:

1. Create the Measure

Go to the Report or Data view, right-click your table in the Fields pane, and select New measure. Paste the following code:

dax
Running Total = 
CALCULATE(
    [Total Sales], 
    FILTER(
        ALLSELECTED('Date'), 
        'Date'[Date] <= MAX('Date'[Date])
    )
)

Breakdown of the formula:

  • [Total Sales]: Replace this with the name of the measure you are tracking (e.g., SUM(Sales[Amount])).
  • ALLSELECTED('Date'): This ensures the running total respects any slicers or filters you have on your page. If you want the total to ignore all filters, use ALL('Date') instead.
  • FILTER(...): This keeps the calculation moving forward, only including dates that are on or before the current row's date.

2. Visualize it

  1. Select a visual (like a Line chart or Table).
  2. Add your Date field to the X-axis (or Rows).
  3. Add your newly created Running Total measure to the Y-axis (or Values).

A quick tip: Make sure your Date table is marked as a "Date Table" in Power BI to ensure the time-intelligence functions work perfectly. If you are using a simple column from your sales data instead of a proper Date table, simply replace 'Date'[Date] with your specific date column.

Answering this used an estimated 90% less than EcoRouter’s configured frontier baseline

Routed to
Efficient
Tokens
472 in / 404 out
Cost
$0.0007
Baseline
$0.0075

Figures recorded by EcoRouter when this answer was generated, and fixed at that moment. Cost comparisons are against a configured reference model, not a measurement of electricity, carbon or water.

Ask about this

Ask EcoRouter a follow-up using this Knowledge as context. Nothing becomes public unless you choose to publish it.

Ask a follow-up
0 views

Comments

No comments yet.