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

Cumulative sum from 2 different tables

I have a table with "Issue Open date" and "Issue Closed date"

I need to have cumulative open issue by week

If 2 issue raised in week 19 and 5 issue in week 21, but also 2 issue closed in week 21, then cumulative total for week 21 is 3

 

I duplicate table and got 2 cumulatives for issue raised, issue closed, but I cannot get Cululative(Sum) of those data

Below matrix, week 27 result should be 3 but I get -4

kayo_2-1663580065863.png

Measure I use for cumulative 

------

CumRaised =
CALCULATE (
    SUM ( Sheet1[CountRaised]),
    FILTER(
        ALL ( 'Sheet1' ),
        'Sheet1'[Raised date] <= MAX('Sheet1'[Raised date] )

  )
)
-------------------------
CumRaised =
CALCULATE (
    SUM ( Sheet1[CountRaised]),
    FILTER(
        ALL ( 'Sheet1' ),
        'Sheet1'[Raised date] <= MAX('Sheet1'[Raised date] )

  )
)
-------------To sum up above -----------
CalcOpenIssue = CALCULATE([CumRaised]-[CumClosed])
 
I try to use SUM instead of CALCULATE but it does not accept measure in calculation,
Can anyone help?
Thanks
 
 
6 REPLIES 6
kayo
Frequent Visitor

I have created sample but I do not know how I can share in this forum

Is there way to attach PBI?

@kayo 

You can upload to any file transfer service and share the download link. 

@kayo 

I won't have have access to my PC for the coming hours. Would you like to connect via zoom or teams?

tamerj1
Super User
Super User

Hi @kayo 
Please try 

CalcOpenIssue =
VAR CurrentWeek =
    SELECTEDVALUE ( 'Sheet1'[WeekNum] )
VAR T1 =
    ADDCOLUMNS (
        ALLSELECTED ( 'Sheet1'[WeekNum] ),
        "@Raised", [CumRaised],
        "@Closed", [CumClosed]
    )
VAR T2 =
    FILTER ( T1, [WeekNum] <= CurrentWeek )
RETURN
    SUMX ( T2, [@Raised] - [@Closed] )
kayo
Frequent Visitor

Thank you for your advice, however the result is the same.

Maybe I should explain that I use 3 tables for this measure

Table1. Original input to cumulate count column date "issue raised"

kayo_0-1663587612890.png

 

Table 2. copy of original table to cumulate count column date "issue closed" 

Table 3. Calendar date to create relation between Raised date and Closed date to get week summary

 

Hi @kayo 
It would be much better if you can prepare a sample pbix file to work with. Thank you.

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.