Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

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. 

johnray_1-1649869934911.png

Requirement:

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. 

johnray_0-1649869423617.png

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

 

CumulativeNumberOfOrders = 
CALCULATE( COUNTROWS('Fact OrderTable'),
        FILTER(ALLSELECTED('Dim DateTimeDim'),'Dim DateTimeDim'[DateTimeForPowerBI]<=MAX('Dim DateTimeDim'[DateTimeForPowerBI])
            )
        )

 

 

 

 

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , 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
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max && 'Date'[Date] <= max('Date'[Date]) ))

 

 

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

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. 

johnray_0-1650899976703.png


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



 

 

Anonymous
Not applicable

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

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.