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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
NathanSaber
Frequent Visitor

Sum to Date

I'm having trouble calculating the Sum to Date when selecting a month from a Slicer.

 

The result I'm expecting is per table below when I select Feb from the Month Slicer

CategoryMonthTo Date
A3080
B100135

 

I've tried the following DAX formula for my To Date Measure, however it is returning the same results as the Month column above.

To Date =

CALCULATE(SUM(Transactions[Amount]),FILTER(ALL(Transactions[Period]),Transactions[Period] <= MAX(Transactions[Period])))

 

The details of the tables are below. They are linked via the Period field in both Tables. One to Many relationship (One - Period Table, Many - Transactions Table)

 

Transactions

PeriodAmountCategory
120A
130B
420A
410A
45B
840B
830A
860B
915A
925B
1210A
1230A

 

Period

PeriodMonth
1Jul
2Aug
3Sep
4Oct
5Nov
6Dec
7Jan
8Feb
9Mar
10Apr
11May
12Jun
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@NathanSaber , In case you have date prefer Time Intelligence

 

In This case, the Assume period is joined to Transaction. Ideally, In such cases you need to have the time/period table separately and use that

To Date =
CALCULATE(SUM(Transactions[Amount]),FILTER(ALL(Period),Period[Period] <= MAX(Period[Period])))

 

In case you have a Date, refer

Power BI — YTD
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @NathanSaber,

You can add a values function to your formula to simple group the rolling result based on the current category:

To Date =
CALCULATE (
    SUM ( Transactions[Amount] ),
    FILTER (
        ALLSELECTED ( Transactions[Period] ),
        Transactions[Period] <= MAX ( Transactions[Period] )
    ),
    VALUES ( Transactions[Category] )
)

DAX – The Many Faces of VALUES() 

BTW, I'd like to suggest you use allselected to replace all function if you want to keep original filter effects apply on your table:

Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT 
Regards,

Xiaoxin Sheng

amitchandak
Super User
Super User

@NathanSaber , In case you have date prefer Time Intelligence

 

In This case, the Assume period is joined to Transaction. Ideally, In such cases you need to have the time/period table separately and use that

To Date =
CALCULATE(SUM(Transactions[Amount]),FILTER(ALL(Period),Period[Period] <= MAX(Period[Period])))

 

In case you have a Date, refer

Power BI — YTD
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Super User
Super User

@NathanSaber - Try

Measure =
  VAR __Category = MAX('Transactions'[Category])
  VAR __Period = MAX('Period'[Period])
RETURN
  SUMX(FILTER(ALL('Transactions'),[Category]=__Category && [Period]<=__Period),[Amount])


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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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