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
Siddiq1212
Frequent Visitor

Dax to calculate cumulative sum of columns of 2 different tables

Hi experts,

I am new to the community. Thank you for your support.

I am trying to find a dax to cacluate cumulative sum of these two columns (which are from 2 different tables).

Any guess...

Screenshot 2025-06-09 202250.png

1 ACCEPTED SOLUTION

I am sorry, it is quit hard for me, am not able to find it.

View solution in original post

18 REPLIES 18
v-karpurapud
Community Support
Community Support

Hi @Siddiq1212 

Please try the below DAX:

Cum Combined Cost :=

VAR MaxEarned = CALCULATE(

    MAX('TableA'[Cum Earned Value Cost]),

    ALL('TableA')

)

RETURN

IF(

    NOT ISBLANK('TableB'[Cum Forecast Cost]) && 'TableB'[Cum Forecast Cost] > 0,

    'TableB'[Cum Forecast Cost] + MaxEarned,

    BLANK()

)

 

If this doesn’t fully meet your needs, could you kindly share a sample of your data or .PBIX file? That would help us provide a more accurate solution.
 

If this response resolves your query, kindly mark it as Accepted Solution to help other community members. A Kudos is also appreciated if you found the response helpful.


Regards,
Karpurapu D,
Microsoft Fabric Community Support Team.

 

Hi Karpurapu D,

I am unable to upload .pbix file. Kindly Suggest (I am new here.)

Siddiq1212_0-1749622830899.png

 

Hi @Siddiq1212 

Sure, I will guide you through the steps below.

Navigate to the forum, and under the reply box, click on the browser.

vkarpurapud_0-1749623476252.png


After that, a folder tab will open. Choose the appropriate PBIX file, click on open, and then upload.

vkarpurapud_2-1749623632741.png


Once the file is successfully loaded, click on post.

 

vkarpurapud_3-1749623669004.png



Regards,
Karpurapu D,
Microsoft Fabric Community Support Team.



I am sorry, it is quit hard for me, am not able to find it.

There is no file there.

SamsonTruong
Impactful Individual
Impactful Individual

Hi @Siddiq1212,

You can achieve this through creating a measure. Depending on whether or not these two tables are connected to a Date Table will change the approach slightly.

Assuming both of these tables are connected to the same Date Table, try the following DAX measure:

Total **bleep** Cost :=
VAR SelectedDate = MAX('Date'[Date])
VAR CumEarned =
    CALCULATE(
        MAX(TableA[**bleep** Earned Value Cost]),
        FILTER(
            ALL(TableA),
            TableA[Current Months Week] = SelectedDate
        )
    )
VAR CumForecast =
    CALCULATE(
        MAX(TableB[**bleep** Forecast Cost]),
        FILTER(
            ALL(TableB),
            TableB[Current Months Week] = SelectedDate
        )
    )
RETURN
COALESCE(CumEarned, 0) + COALESCE(CumForecast, 0)


In the case where these tables are disconnected and are not leveraging a Date Table. try the following DAX measure:

Total **bleep** Cost :=
VAR SelectedDate = MAX(TableA[Current Months Week])
VAR CumEarned =
    CALCULATE(
        MAX(TableA[**bleep** Earned Value Cost]),
        TableA[Current Months Week] = SelectedDate
    )
VAR CumForecast =
    CALCULATE(
        MAX(TableB[**bleep** Forecast Cost]),
        TREATAS({ SelectedDate }, TableB[Current Months Week])
    )
RETURN
COALESCE(CumEarned, 0) + COALESCE(CumForecast, 0)


Please let me know if either of these achieve your desired result.

If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.

Thanks,

Samson

 

Connect with me on LinkedIn

Check out my Blog

Going to the European Microsoft Fabric Community Conference? Check out my Session

Hi @SamsonTruong 

Thank you for your reply. I think I didn't get it properly.

Yes both tables are connected with date table " Current Month Week" column.

Hi @Siddiq1212 ,

Thank you for the additional context. Please try the adjusted DAX measure:

Total **bleep** Cost :=
VAR SelectedDate = MAX('Date'[Current Months Week])
VAR EarnedValue =
    CALCULATE(
        MAX('FactEarnedValue'[**bleep** Earned Value Cost]),
        FILTER(
            ALL('FactEarnedValue'),
            'FactEarnedValue'[Current Months Week] = SelectedDate
        )
    )
VAR ForecastCost =
    CALCULATE(
        MAX('FactForecast'[**bleep** Forecast Cost]),
        FILTER(
            ALL('FactForecast'),
            'FactForecast'[Current Months Week] = SelectedDate
        )
    )
RETURN
COALESCE(EarnedValue, 0) + COALESCE(ForecastCost, 0)

HI@SamsonTruong 

Sorry to bother again. I am not getting it. Tried as below.

Siddiq1212_0-1749498273398.png

 

Hi @Siddiq1212 

 

Try with below DAX:

 **bleep** Combined Cost :=

VAR MaxEarned = CALCULATE(

MAX('TableA'[**bleep**  Earned Value Cost]),

ALL('TableA') )

RETURN IF( NOT ISBLANK('TableB'[**bleep** Forecast Cost]) && 'TableB'[**bleep** Forecast Cost] > 0, 'TableB'[**bleep** Forecast Cost] + MaxEarned,

BLANK() )

 

 

Hi @SamsonTruong 

Thank you for your reply. I think I didn't get it properly.

Yes both tables are connected with date table " Current Month Week" column.

Hi @SamsonTruong 

Thank you for your reply. I think I didn't get it properly.

Yes both tables are connected with date table " Current Month Week" column.

 

Hi,

Share the download link of the PBI file.  Do you want the total to show up in a card visual?  If not, then clearly show the expected result.

Hi @Ashish_Excel 

Thank you for replying.

I am looking for a DAX to calculate cumulative sum of both columns to prepare a overall cumulative curve. The total in 31 Dec'23 will be 13,541,123+101,384,574.60 = 114,925,697.60

Siddiq1212_0-1749520968754.png

 

Hi @Ashish_Excel , @SamsonTruong ,

To simplify I need a DAX to calculate maximum value of column **bleep** Earned value cost & add to **bleep** Forecast cost. Something like below (if we talk about excel)

if (**bleep** Forecast Cost=0,"",**bleep** Forecast Cost+max(**bleep** Earned Value Cost)

Siddiq1212_0-1749565312135.png

 

As requested ealier, share the download link of the PBI file.

hnguy71
Super User
Super User

Hi @Siddiq1212 

 

You can just use the sum function.

 

= SUM(**bleep** Earned Value Cost) + SUM(**bleep** Forecast Cost)

 

However, you'll need to make sure that the Date evaluation comes from a dimension table that's connected to both of your tables.



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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