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
sherwood
Helper I
Helper I

Calculate total sum between date from one table and today's date

Likely an easy one for a Power BI Guru, but my calculation is not returning the correct result.

I have data like the below table, with Device Returned Date coming from a separate data source. 

sherwood_0-1678122189156.png

The Cost Since Return column (that I'm trying to write a calculation for) is shown above as my desired result.

I'm trying to write a calculation that can give me totals like:

sherwood_1-1678122368453.png



I'm not sure what I'm doing wrong but my calculation is showing incorrect figures between Service Cost and Cost Since Return, giving me bogus totals. 

Any help greatly appreciated. 

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @sherwood 

 

You can try the following methods.

Column = 
IF ( 'Table'[Device Returned Date] <> BLANK (),
    CALCULATE ( SUM ( 'Table'[Service Cost] ),
        FILTER ( 'Table',
            [Billing Month] >= [Device Returned Date]
                && [Billing Month] <= TODAY ()
                && [Device ID] = EARLIER ( 'Table'[Device ID] )
        )
    ),
    BLANK ()
)

vzhangti_0-1678427213985.png

vzhangti_1-1678427232169.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

8 REPLIES 8
v-zhangti
Community Support
Community Support

Hi, @sherwood 

 

You can try the following methods.

Column = 
IF ( 'Table'[Device Returned Date] <> BLANK (),
    CALCULATE ( SUM ( 'Table'[Service Cost] ),
        FILTER ( 'Table',
            [Billing Month] >= [Device Returned Date]
                && [Billing Month] <= TODAY ()
                && [Device ID] = EARLIER ( 'Table'[Device ID] )
        )
    ),
    BLANK ()
)

vzhangti_0-1678427213985.png

vzhangti_1-1678427232169.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

That's great, Charlotte! Many thanks.

FreemanZ
Super User
Super User

hi @sherwood 

could you elaborate how to get the values in Cost Since Return column?

Please share a good data example, no screenshot. Are this columns or measures? give us some "light" 🙂





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

Proud to be a Super User!




Here's the calculation I've been trying, but I don't think it's correct. I'm getting unexpected figures from it.


Cost Since Return = 
IF( ' Table1' [Device Returned Date] <> BLANK,

CALCULATE(
SUM( 'Table1' [Service Cost]),
DATESBETWEEN(
'Table1' [Billing Month],
'Table1' [Device Returned Date],
TODAY (),
))
BLANK,
)

andhiii079845
Solution Sage
Solution Sage

Than make a good example. We need the uderlaying data structure, make it easier to help. 





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

Proud to be a Super User!




andhiii079845
Solution Sage
Solution Sage

Can you share please all involved tables with the example. Please use the internal table function, no screenshot. 

I do not really understand you disired result column, you write 50,50, show it be 50,100 (because of 2 service cost month?





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

Proud to be a Super User!




Hi, this is representative data as I'm unable to share the original. 

The desired result is to include the Service Cost only in months after the Device Return Date.

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.