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

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

Reply
Anonymous
Not applicable

Add table column that sum between dates using DATESBETWEEN - only returns value for current row

I've seen quite a lot of suggestions using the below approach on the internet, also on Microsoft's site - however, when I'm attempting to insert a custom column in a table to sum values across a period of time, it's only returning the value of the current row (can be seen in image further down). Here's the snippet used:

value sum = CALCULATE (
    SUM ('Table'[Value]); 
    DATESBETWEEN ('Table'[Date]; DATE (2019;1;1); DATE (2019;1;30))
    )

I have a table called "Table" (surprise) and inserted the above snippet. The result is as below: 

 

test.PNG

 

I've seen multiple sites stating taht this should SUM the values inbetween the dates, but for whatever reason I can't make it work? I've checked that there are no relations between the table in question and any others.

Am I missing something or 

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You dax is correct but it should be a measure. If you want use calculated column to show the sum, you can refer to the following dax:

Column =
CALCULATE (
    SUM ( 'Table'[Value] ),
    DATESBETWEEN ( 'Table'[Date], DATE ( 2019, 01, 01 ), DATE ( 2019, 01, 31 ) ),
    ALL ( 'Table' )
)

or

 

Column 2 =
SUMX (
    FILTER (
        'Table',
        'Table'[Date] >= DATE ( 2019, 01, 01 )
            && 'Table'[Date] <= DATE ( 2019, 01, 31 )
    ),
    'Table'[Value]
)

Here is the result.

2-1.PNG

The difference between measure and calculated column can be found in this link:

https://community.powerbi.com/t5/Desktop/column-vs-measure/td-p/13201

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

1 REPLY 1
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You dax is correct but it should be a measure. If you want use calculated column to show the sum, you can refer to the following dax:

Column =
CALCULATE (
    SUM ( 'Table'[Value] ),
    DATESBETWEEN ( 'Table'[Date], DATE ( 2019, 01, 01 ), DATE ( 2019, 01, 31 ) ),
    ALL ( 'Table' )
)

or

 

Column 2 =
SUMX (
    FILTER (
        'Table',
        'Table'[Date] >= DATE ( 2019, 01, 01 )
            && 'Table'[Date] <= DATE ( 2019, 01, 31 )
    ),
    'Table'[Value]
)

Here is the result.

2-1.PNG

The difference between measure and calculated column can be found in this link:

https://community.powerbi.com/t5/Desktop/column-vs-measure/td-p/13201

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.