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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
um_mir
Frequent Visitor

Cumulative Sum with two filters

Hi Experts,

 

Can someone please help me with below issue. I have data like this:

 

TableA

SequenceNumberYear
1302016
1312016
1322017
1332017
1342018
1352018
1362019

 

Measure [NetGrowth] works good.

 

My [NetGrowth] cumulative measure is

NetGrowthCumulative = 
VAR MyYearMin = MINX(TableA,TableA[Year])
VAR MyYearMax = MAXX(TableA,TableA[Year])
RETURN 
SUMX(
    FILTER(
        ALL(TableA),TableA[SequenceNumber]<=MAX(TableA[SequenceNumber]) 
            && TableA[Year]>=MyYearMin && TableA[Year]<=MyYearMax
        ),
    [NetGrowth]
)

 

 
This [NetGrowthCumulative] measure works for one year window only. It resets for every year. Please see my screen shot below where from 352 to 361 is year 2018 & 362 to 363 is year 2019.Cumulative.PNG
How can i fix this? Any solutions will be much appreciated.
 
Thank you
1 ACCEPTED SOLUTION
um_mir
Frequent Visitor

Hello,

 

I got this working. Hope below solution will help someone:

 

1. Created a measure in TableA to get selected Year

SelectedYear = 
VAR t = ALLSELECTED(TableA[Year])
RETURN 
IF(MAX(TableA[Year]) in t,1,0)

2. Cumulative Measure code

 

NetGrowthCumulative = 
SUMX(
    FILTER(
        ALLEXCEPT(TableA,TableA[Year]),
        TableA[SeqNo]<=MAX(TableA[SeqNo]) && [SelectedYear]=1
        ),
[NetGrowth])

3. Make sure there is relationship between TableA & TableB.

 

 

Regards

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @um_mir,

 

What is your meausre [NetGrowth]? Could you please share your sample data and excepted result to me, if you don't have confidential data? Please upload your file to One Drive and share the link here.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @v-frfei-msft

 

Thank you for your quick response. Please see the link for the pbxi file. I have reproduced the issue. Cummulative sum works for a year and it resets again in the next year. For the attached example NetGrowthCumulative I'm exepecting below result:

 

YearSeqNoNetGrowthNetGrowthCumulative
20181100100
2018250150
2018395245
20184-50195
20185120315
2019620335
2019780415

 

Regards

um_mir
Frequent Visitor

Hello,

 

I got this working. Hope below solution will help someone:

 

1. Created a measure in TableA to get selected Year

SelectedYear = 
VAR t = ALLSELECTED(TableA[Year])
RETURN 
IF(MAX(TableA[Year]) in t,1,0)

2. Cumulative Measure code

 

NetGrowthCumulative = 
SUMX(
    FILTER(
        ALLEXCEPT(TableA,TableA[Year]),
        TableA[SeqNo]<=MAX(TableA[SeqNo]) && [SelectedYear]=1
        ),
[NetGrowth])

3. Make sure there is relationship between TableA & TableB.

 

 

Regards

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors