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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
ArchStanton
Impactful Individual
Impactful Individual

Blank out future running total values

Hi,

How can I amend my code to remove the future running total values below?

ArchStanton_0-1737118546022.png

Running Total Closed = 
VAR LastVisibleDate = MAX (ResolutionTable[Date])
RETURN
    CALCULATE(
        [Inactive Cases],
        ResolutionTable[Date] <= LastVisibleDate,
        REMOVEFILTERS('Cases'))
    

 

Thanks

15 REPLIES 15
Anonymous
Not applicable

Hi, @ArchStanton 

I envision your case, there are other states in your case table:

vjianpengmsft_0-1737541162965.png

Using MAX directly('Cases'[Resolution Date]) will fetch the date of the non-sovled state, which will cause future dates to have values:

vjianpengmsft_1-1737541284588.png

 

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Hi,

A case that has a Resolution date can only have one statecode which is "Resolved", if the case does not have a Resolution date then the case is Active (my Inactive Cases measure is below):

 

Inactive Cases = CALCULATE(
                DISTINCTCOUNT('Cases'[incidentid]),
                'Cases'[statecode] = "Resolved")

 

 So there shouldn't really be any future values as the latest / last Resolution Date is the 16th Jan, therefore Feb & Mar should be Blank().

Anonymous
Not applicable

Hi, @ArchStanton 

Thank you very much for your reply. Can you describe how my sample data differs from yours? So that I can better identify the problem and provide you with a better solution.
Or you provide some virtual data/screenshots that don't contain privacy.

 

Best Regards

Jianpeng Li

Ps I changed the EndDate from 31 Mar 2025 to MAX('Cases'[Resolution Date] and it sort of works but I've now lost the future months if I need to put them on the x axis of a chart. This is not what I'm looking for.

ArchStanton_0-1737551783742.png

 

No problem, hope the following makes sense.

Your Cases Table should not contain future resolution dates, cases are 'active' and do not have a resolution date until they are closed - you cannot close something in the future!
My Cases table has the 16th Jan as the latest resolution date, I have not refreshed it for a few days but I don't need to do this.

My resolution Table is essentially a copy of my main Date Calendar table:

ArchStanton_0-1737548466556.png


Maybe i should change the EndDate to be the YEAR(MAX('Cases'[Resolution Date])) instead of 31st Mar?

 

 

 

Anonymous
Not applicable

Thank you Wilson_ and bhanu_gautam 

Hi, @ArchStanton 

I'm guessing that the fiscal year month column on your left is from your date table, and your date table has a 1-to-many relationship with the ResolutionTable table.

vjianpengmsft_0-1737429645343.png

Build the following measure on top of keeping your measure:

Measure 3 = IF(MIN('Table'[Date])<=MAX('ResolutionTable'[Date]),[Running Total Closed],BLANK())

This will determine the minimum date of each month in your matrix and then compare it to your ResolutionTable[Date] maximum date, ensuring that your measure is only executed within the maximum date, and future dates beyond that are returned empty.

vjianpengmsft_1-1737429848747.png

I've uploaded the PBIX file I used this time below.

 

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Thank you. I've replied to Wilson because his DAX didn't work as there was some confusion as to what was my Calendar table and what was my FACT table, hopefully this extra detail will make sense to you both!

Wilson_
Super User
Super User

Hi ArchStanton,

 

I'm assuming your matrix row headers come from a separate date table. If so, try the below:

Running Total Closed = 
VAR LastVisibleDate = MAX ( ResolutionTable[Date] )
VAR MaxCalendarDate = MAX ( Calendar[Date] )
RETURN
    IF ( 
        MaxCalendarDate <= LastVisibleDate,
        [Inactive Cases]
    )


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





ArchStanton
Impactful Individual
Impactful Individual

When I use your code it partially works, future months are blanked but the cumulative running total disappears:

Running Total Closed2 = 
VAR LastVisibleDate = MAX (ResolutionTable[Date])
VAR MAXResolutionDate = MAX('Cases'[Resolution Date])
RETURN
IF(
    MAXResolutionDate <=LastVisibleDate,
    [Inactive Cases])

 

ArchStanton_1-1737479321270.png

 

 

Anonymous
Not applicable

Hi, @ArchStanton 

Thank you for providing very useful information. Based on your information, I created a data set to reproduce the problem of your initial measurement value as follows:

vjianpengmsft_0-1737529010702.png

To do this, I corrected your measurements:

Running Total Closed2 = 
VAR LastVisibleDate = MAX ('Cases'[Resolution Date])
RETURN
    CALCULATE(
        [Inactive Cases],
        ResolutionTable[Date] <= LastVisibleDate,
        REMOVEFILTERS('Cases')
)

It now looks like this:

vjianpengmsft_1-1737529081458.png

You can always check my attachments and ask your questions.

 

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Hi Jianpeng Li,,

Unfortunately, its still not working 😞
Your newest measure is Running Total Closed3 in my Matrix below, I don't recognise the 13366 figure at all, besides, this should be blank anyway:

ArchStanton_0-1737537309093.png

The most recent Resolution Date in the Cases table is 16/01/2025 Feb & Mar should not contain any values but they still do.

 

 

 

Running Total Closed3 = 
VAR LastVisibleDate = MAX('Cases'[Resolution Date])
RETURN
CALCULATE(
[Inactive Cases],
   ResolutionTable[Date] <= LastVisibleDate,
   REMOVEFILTERS('Cases')
)

 

 

 

 

 

Running Total Closed = 
VAR LastVisibleDate = MAX (ResolutionTable[Date])
VAR CurrentDate = TODAY()
RETURN
CALCULATE(
[Inactive Cases],
ResolutionTable[Date] <= LastVisibleDate && ResolutionTable[Date] <= CurrentDate,
REMOVEFILTERS('Cases'))

 

 



 

 

Anonymous
Not applicable

Hi, @ArchStanton 

I understand your needs. Will you be able to check your maximum date on my model or try to return LastVisibleDate back?

VAR LastVisibleDate = MAXX(FILTER('Cases','Cases'[statecode] ="Resolved"),'Cases'[Resolution Date])

vjianpengmsft_1-1737540622936.png

vjianpengmsft_2-1737540662422.png

 

If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.
Thank you for your patience and look forward to hearing from you.

 

 

Best Regards

Jianpeng Li

 

 

 

 

ArchStanton
Impactful Individual
Impactful Individual

Hi,

Sorry, that didn't work, I think I need to provide the following detail:

 

My 2nd calendar table is called Resolution Table and it has a One to Many relationship with my Cases table.

So, the calendar ResolutionTable[Date] field has an active relationship with the 'Cases'[Resolution Date] (this is not a continguous list of dates by the way - not every case has a Resolution Date!).

I have another Calendar table that deals with Active cases only - it has been marked as a DateTable whereas the ResolutionTable has not.

My InactiveCases measure simply counts those cases that have a 'Resolved' status.

 

Inactive Cases = CALCULATE(
                DISTINCTCOUNT('Cases'[incidentid]),
                'Cases'[statecode] = "Resolved")

 

 

If a case has a Resolution Date then it will have a 'Resolved' status.


bhanu_gautam
Super User
Super User

@ArchStanton ,Try using 

Running Total Closed =
VAR LastVisibleDate = MAX (ResolutionTable[Date])
VAR CurrentDate = TODAY()
RETURN
CALCULATE(
[Inactive Cases],
ResolutionTable[Date] <= LastVisibleDate && ResolutionTable[Date] <= CurrentDate,
REMOVEFILTERS('Cases'))

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi,

I've copied your code (see below) and there's still no change to the results.


This (Resolution Table) is not my main date table, do you think that has that got anything to do with this not working?

Running Total Closed = 
VAR LastVisibleDate = MAX (ResolutionTable[Date])
VAR CurrentDate = TODAY()
RETURN
    CALCULATE(
        [Inactive Cases],
        ResolutionTable[Date] <= LastVisibleDate && ResolutionTable[Date] <=CurrentDate,
        REMOVEFILTERS('Cases'))
    




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors