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! Request now

Reply
uscmea
Frequent Visitor

Cumulative Sum

Hi,

I have three main measures in my data model:

 

sales = DISTINCTCOUNT(Sales[Product ID])

leads = DISTINCTCOUNT(Leads[Lead ID])
conv = IF([vacation_days]<7,[sales]/[leads],0)
 
The measure I want to do the cumulative is "conv", which depends on the number of vacation days that each employee has taken in a month. If the number of days is greater than 7, "conv" is going to be equal to 0%; if not, sales/leads.
When I try to do the cumulative sum of "conv", with the following formula:
 
cum_conv =
CALCULATE (
[conv],
FILTER (
ALL( 'Calendar'),
ISONORAFTER( 'Calendar'[Month Number]
,MAX ( 'Calendar'[Month Number] ),DESC
)
))
 
Instead of obtaining 42.86% in Month Number = 2, I obtain 0%.
 
uscmea_1-1624606462592.png

 Here find attached the Power BI model. https://drive.google.com/file/d/1izQnlhw_geZtn4bfe5T-by3BB__mbwFK/view?usp=sharing

 

Thank you in advance for your help!

 

Best,
Sara

1 ACCEPTED SOLUTION

@uscmea,

 

Try this measure:

 

cum_conv = 
VAR vCurrentMonth =
    MAX ( 'Calendar'[Month Number] )
VAR vTable =
    ADDCOLUMNS ( ALLSELECTED ( 'Calendar'[Month Number] ), "@conv", [conv] )
VAR vResult =
    SUMX ( vTable, IF ( 'Calendar'[Month Number] <= vCurrentMonth, [@conv] ) )
RETURN
    vResult

 

DataInsights_0-1625868991977.png

 





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

Proud to be a Super User!




View solution in original post

4 REPLIES 4
DataInsights
Super User
Super User

@uscmea,

 

I wasn't able to access the pbix via the link. This is the basic pattern for a cumulative sum:

 

cum_conv =
CALCULATE (
    [conv],
    FILTER (
        ALL ( 'Calendar' ),
        'Calendar'[Month Number] <= MAX ( 'Calendar'[Month Number] )
    )
)

 





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

Proud to be a Super User!




Hi @DataInsights,

 

Thank you very much for your answer!

 

I tried before this formula, but for some reason, it is not working.

 

I also tried SUMX = (FILTER (ALL('Calendar'),'Calendar'[Month Number] <=MAX('Calendar'[Month Number]), [conv])), but I still do not obtain the desired result.


I shared the Power BI model via Drive, let me know if you can download it from there. 

Best regards,

Sara

@uscmea,

 

Try this measure:

 

cum_conv = 
VAR vCurrentMonth =
    MAX ( 'Calendar'[Month Number] )
VAR vTable =
    ADDCOLUMNS ( ALLSELECTED ( 'Calendar'[Month Number] ), "@conv", [conv] )
VAR vResult =
    SUMX ( vTable, IF ( 'Calendar'[Month Number] <= vCurrentMonth, [@conv] ) )
RETURN
    vResult

 

DataInsights_0-1625868991977.png

 





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

Proud to be a Super User!




Thank you very much for your help, @DataInsights !!

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.