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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
gautampruthi
Helper II
Helper II

Incorrect Cumulative Sum for Non Continuous Date

I am trying to plot a line graph using cumulative sum and Date (Non Continious) the issue is the line graph is broken

gautampruthi_0-1724318442400.png

 


Measure Code
Cumulative Offer and acceptance Count =
VAR CurrentRowDate = MAX('srs_cap'[cap_decd])
RETURN
CALCULATE(
countrows('srs_cap'),
'srs_cap'[cap_decd] <= CurrentRowDate
)

When i am extracting the data of line chart it is showing as
Cumulative Offer and acceptance Count , Date.
899 03/07/2024 00:00
904 04/07/2024 00:00
1 05/07/2024 00:00
907 08/07/2024 00:00
1 09/07/2024 00:00
910 10/07/2024 00:00
913 11/07/2024 00:00
1 15/07/2024 00:00
915 16/07/2024 00:00
916 17/07/2024 00:00
923 18/07/2024 00:00
928 19/07/2024 00:00

I can see the issue as sum is breaking at some date for eg
913 11/07/2024 00:00
1 15/07/2024 00:00
915 16/07/2024 00:00

it should be 914 on 15/07/2024 instead of 1.

i tried changing X axis to categorical and Continious, Created a Custom Date table, How can i fix this 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @gautampruthi - Can you double-check the relationships between your tables and ensure that the Date table covers the entire date range relevant to your data.The main problem is that your cumulative sum calculation doesn't properly handle gaps in the dates, causing it to reset when there's no data for a particular date.

you need to adjust your cumulative measure to reference the Date table rather than just the dates in the srs_cap table. 

 

Cumulative Offer and Acceptance Count =
VAR CurrentRowDate = MAX('DateTable'[Date])
RETURN
CALCULATE(
COUNTROWS('srs_cap'),
'srs_cap'[cap_decd] <= CurrentRowDate,
ALL('DateTable')
)

 

The cumulative sum should now increment properly, avoiding resets where there are no data points for certain dates.

 

Hope it helps





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

Proud to be a Super User!





View solution in original post

2 REPLIES 2
MattAllington
Community Champion
Community Champion

Do you have a date table?  It doesn't look like it. Your transaction table contains only the dates of the transactions. It is not possible to return a value (cumulative value in this case) for a date that doesn't exist in your loaded data. If you add a date table containing all dates (including those that have no sales), then you can build the chart you need. 
https://exceleratorbi.com.au/power-bi-calendar-tables/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.
rajendraongole1
Super User
Super User

Hi @gautampruthi - Can you double-check the relationships between your tables and ensure that the Date table covers the entire date range relevant to your data.The main problem is that your cumulative sum calculation doesn't properly handle gaps in the dates, causing it to reset when there's no data for a particular date.

you need to adjust your cumulative measure to reference the Date table rather than just the dates in the srs_cap table. 

 

Cumulative Offer and Acceptance Count =
VAR CurrentRowDate = MAX('DateTable'[Date])
RETURN
CALCULATE(
COUNTROWS('srs_cap'),
'srs_cap'[cap_decd] <= CurrentRowDate,
ALL('DateTable')
)

 

The cumulative sum should now increment properly, avoiding resets where there are no data points for certain dates.

 

Hope it helps





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

Proud to be a Super User!





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 MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.