Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Display running total during a selected day, and the day before

Hi all, 

I have a slicer where I can choose dates to calculate the running total for any day that I select and display it on a line graph. 



I need to overlay the graph with the running total of the previous day. How do I rewrite my measure such that when I select the same date above, the graph will display the running total for both 20220114 and 20220113?

Data and Measure used:

I have a Date Dimension Table that looks like the one below:
A day which is identified by the DateID column starts from 8pm the previous day and ends 7:59pm the following day. 


So to calculate the Running Total I use the below measure :


CumulativeNumberOfOrders = 
        FILTER(ALLSELECTED('Dim DateTimeDim'),'Dim DateTimeDim'[DateTimeForPowerBI]<=MAX('Dim DateTimeDim'[DateTimeForPowerBI])





Super User
Super User

@johnray , If you select one date and want data for more than one date you need independent date table 

//Date1 is independent Date table, Date is joined with Table

new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = _max -1
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max && 'Date'[Date] <= max('Date'[Date]) ))



Need of an Independent Date Table:

Hi @amitchandak 
the solution you provided does not seem to give me the graph I needed: 

HI @amitchandak the solution you provided does not seem to give me cumulative graph. 


I need to display the cumulative sum as displayed on the LHS, however the script you provided displays individual orders at specific times.



hi  @amitchandak , did you mean have two dates table ? Date1 and Date, where Date1 is not connected to anything and Date is connected to my fact table?

Helpful resources


2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.