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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

How to get Cumulative Total to stop at today's date on graph

I have a measure that is cumulatively counting the amount of cases created over time. Right now the formula looks like this:

1.PNG

 

And while this works as intended, it populates for future months on my graph which is the black line below:

2.PNG

 

So far as of 2/17/2020, there have been 487 cases created but as you can see, 487 is populated for every month. How can I get line on the graph to just stop in February at 487? I don't need it populated for any future dates until we've actually reached those dates. I have a date slicer on the page that is set to the entire year of 2020.

1 ACCEPTED SOLUTION
edhans
Super User
Super User

@Anonymous - see this article by SQLBI on hiding future dates in measures. You can do this either in Power Query or in DAX, but essentially what you'll do is create a column that is TRUE/FALSE for a future date.

 

In Power Query, add a custom column with the following formula:

 

= if [Date] > DateTime.Date(DateTime.LocalNow()) then true else false

 

Or, in DAX (not recommended unless you don't have access to Power Query as DAX calculated columns generally don't perform as well in the overall model):

 

IsFutureDAX = 
if(
    DATE[Date] > TODAY(),
    TRUE(),
    FALSE()
)

 

 Then you simply filter out the TRUE values in measures. For example in this pseudocode:

 

Test Measure =
CALCULATE(
    SUM(Sales[Sales Amount),
    DATE[IsFuture] = FALSE()
)

 

 

You can also use either IsFuture or IsFutureDAX columns as a filter for visuals by dropping it in the filter and excluding the TRUE values. The dates and IsFuture columns will automatically update with each report refresh.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

6 REPLIES 6
edhans
Super User
Super User

@Anonymous - see this article by SQLBI on hiding future dates in measures. You can do this either in Power Query or in DAX, but essentially what you'll do is create a column that is TRUE/FALSE for a future date.

 

In Power Query, add a custom column with the following formula:

 

= if [Date] > DateTime.Date(DateTime.LocalNow()) then true else false

 

Or, in DAX (not recommended unless you don't have access to Power Query as DAX calculated columns generally don't perform as well in the overall model):

 

IsFutureDAX = 
if(
    DATE[Date] > TODAY(),
    TRUE(),
    FALSE()
)

 

 Then you simply filter out the TRUE values in measures. For example in this pseudocode:

 

Test Measure =
CALCULATE(
    SUM(Sales[Sales Amount),
    DATE[IsFuture] = FALSE()
)

 

 

You can also use either IsFuture or IsFutureDAX columns as a filter for visuals by dropping it in the filter and excluding the TRUE values. The dates and IsFuture columns will automatically update with each report refresh.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Greg_Deckler
Community Champion
Community Champion

Try modifying your FILTER clause to be:

 

FILTER(ALLSELECTED(Opportunity), Opportunity[Value] <= MAX(Date[Date]) && Opportunity[Value] <= TODAY())



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler I tried that and it unfortunately returned the same result. @amitchandak I tried your suggestion as well and doing it that way doesn't make it a cumulative total but just totals for each particular month. 

I went ahead and added a visual level filter of date. And use a relative date filter. And set it in the last 5 years. That is my data max.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Going to need sample data to test with then. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

Replace max(Date[Date]) with Today()

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Datanaut Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors