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
LaurenceSD
Advocate II
Advocate II

Running Total - Resets with Date Filter

Hi,

 

I've got a formula for calculating a running total which is this

 

Bookings This Year Running Total =
if(max(Dates[Date])<=today(),
CALCULATE(
    [Bookings This Year],
    FILTER(
        ALLSELECTED('Dates'[Date]),
        ISONORAFTER('Dates'[Date], MAX('Dates'[Date]), DESC)
    )
),BLANK())
 
The problem I've got is when I use a date slicer, the count doesn't reset, is there a way I can modify this formula, so that when i select a FY and a month, that the start value rests to 0, so in the below example, instead of 1st Jan 2024 representing the 39,134th booking ever, it would said say 2 & 23rd January 2024 would say 458
 
LaurenceSD_0-1706030332746.png

The dataset used in this report is massive, so hard for me to upload, but if needed I can try and create a smaller replica

 

Thanks

3 REPLIES 3
Daniel29195
Super User
Super User

hello @LaurenceSD 

modification to your code : 

Bookings This Year Running Total =
var min_date =  calculate(min(dates[date]),  allselected(dates[date]))
var max_date = max(dates[date])
if(max(Dates[Date])<=today(),
CALCULATE(
    [Bookings This Year],
all(dates[date]) ,
  dates[date] <=max_date  , 
dates[date] > = min_date
)
 
),BLANK())
 
 
 
 
let me know if you need any other help
 
 
 
If my response has successfully addressed your issue kindly consider marking it as the accepted solution! This will help others find it quickly. Dont forget to hit that  thumbs up button 🫡👍
LaurenceSD
Advocate II
Advocate II

Bookings This Year is simply a countrows formula, labeled as This Year for ease (I then have LY, LY-1, LY-2, etc coming off with SAMEPERIODLASTYEAR) but nothing clever going on with it.

 

I'll check out the video looks useful, thanks

Greg_Deckler
Super User
Super User

@LaurenceSD What is the formula for Bookings This Year? You could give BRT a shot. 

Better Running Total - Microsoft Fabric Community

At least that way you could actually troubleshoot what was going on. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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!

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.