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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Asfaa5
Frequent Visitor

Cumulative SUM Problem

Hi Team,

 

I have Tables Sales with column(Contract Start Date, Contract End Date), Calendar Table for Date Measures. Im trying to bring cumulative contract on Monthly Basis, I created 4 Measures:

1. New Adds = CALCULATE(COUNTROWS('Sales'))

2. Policy End = CALCULATE(COUNTROWS('Sales'), USERELATIONSHIP(Sales[Contract_End_Date__c],'Calendar'[Date]))

3. Policy Remaining Count = [New Adds]-[Policy End]

4. Cumulative Active Count =

VAR a =
SUMMARIZE (
FILTER ( ALL ( 'Calendar'),'Calendar'[Date] <= MAX ('Calendar'[Date])),
'Calendar'[Month],
"b", [Policy Remaining Count]
)
RETURN
SUMX(a, [Policy Remaining Count] )
 
The Result as below,
 
MonthNew AddsPolicy EndCumulative Active Count
May-184 4
Jun-18255 255
Jul-18256 256
Aug-181243 1243
Sep-186326 6326
Oct-1825001 25001
Nov-188902 8902
Dec-1815156 15156
Jan-1915983 15983
Feb-1915247 15247
Mar-1925361 25361
Apr-1934938 34938
May-1936601436597
Jun-193599721835779
Jul-195351921653303
Aug-1967089103466055
 
But i need like this :
 
MonthNew AddsPolicy EndCumulative Active Count
May-184 4
Jun-18255 259
Jul-18256 515
Aug-181243 1758
Sep-186326 8084
Oct-1825001 33085
Nov-188902 41987
Dec-1815156 57143
Jan-1915983 73126
Feb-1915247 88373
Mar-1925361 113734
Apr-1934938 148672
May-19366014185269
Jun-1935997218221048
Jul-1953519216274351
Aug-19670891034340406
 
Please guide me on the DAX Measures, where i have done the mistake and what needs to be corrected.
 
 
 
 
2 REPLIES 2
Asfaa5
Frequent Visitor

Hi, Please find the screenshot of some data.Relationship.JPGCalendar.JPGSales Data.JPG

 

If i change bring the New Adds instead of Policy Remaining Count, It doesnt deduct the Policy End Count.

Greg_Deckler
Super User
Super User

Tough to be specific without sample source data. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

That being said, what if you replaced Policy Remaining Count in your Cumulative Active Count measure with New Adds?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Top Kudoed Authors