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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
joshua1990
Post Prodigy
Post Prodigy

Running total until today

Hi all!

I have a simple line bar chart that displays the latest information (Sum Value) vs the Budget.

The line represents the budget accumulated per day for the selected month.

The bar represents the actual sales.

Now I would like to display a bar chart for the current month with a line for the full month but bars just for the past and today.

This measure displays the running total sum until today also for the next days.

How can I cut this by today?

Runnint Total = 
CALCULATE(
    SUMX(
        'Calendar',
        [Sales]
    ),
    FILTER(
        ALL( 'Calendar' ),
        'Calendar'[Year]
            = VALUES( 'Calendar'[Year] )
            && 'Calendar'[Month Num]
                = MAX( 'Calendar'[Month Num] )
            && 'Calendar'[Date]
                <= MAX( 'Calendar'[Date] )
    )
)
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@joshua1990 Better Running Total - Microsoft Power BI Community



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...

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi  @joshua1990 ,

I created some data:

vyangliumsft_0-1675733540421.png

Here are the steps you can follow:

1. Create measure.

past and today =
IF(
MAX('Calendar'[Date])>=DATE(YEAR(TODAY()),MONTH(TODAY()),1)
&&
    MAX('Calendar'[Date])<=TODAY(),
SUMX(
    FILTER(ALL('Calendar'),
    'Calendar'[Date]<=MAX('Calendar'[Date])&&'Calendar'[Year]=MAX('Calendar'[Year])&&'Calendar'[Month Num]=MAX('Calendar'[Month Num])),[Sales]),BLANK())
full month =
IF(
MAX('Calendar'[Date])>=DATE(YEAR(TODAY()),MONTH(TODAY()),1)
&&
    MAX('Calendar'[Date])<=TODAY(),
SUMX(
    FILTER(ALL('Calendar'),
    'Calendar'[Year]=MAX('Calendar'[Year])&&'Calendar'[Month Num]=MAX('Calendar'[Month Num])),[Sales]),BLANK())

2. Result:

vyangliumsft_1-1675733540432.png

 

Best Regards,

Liu Yang

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

Greg_Deckler
Community Champion
Community Champion

@joshua1990 Better Running Total - Microsoft Power BI Community



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...

@Greg_Deckler : Thanks a lot for sharing this alternative. But please note, my question is different > How can I cut a running total chart for the whole month (distributed per day) but with just values for the past?

Using your approach I still get a values for tomorrow etc.

@joshua1990 Handling tomorrow values is pretty easy, you just need an IF statement. 

  // Your code that results in a running total in a VAR named __RT
  VAR __Result = IF(MAX('Date'[Date]) > TODAY(),BLANK(),__RT)
RETURN
  __Result

 



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...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.