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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Abhilash_P
Impactful Individual
Impactful Individual

Cumulative totals for all days except month end dates

Hello everyone,
I have date column and Sales amount column i wanted to created cumulative totals but below are the scenarios is should consider
If data is month end data the it should consider month end date sales insted of cumulative sales and next cumulation should start from that month end date below is the table 
Date and Sales Amount column are availbe in date nee output as requrired output column

 

DateSales AmountCumulative SalesRequired output Calculation Logic
25 May 20235405994.945405994.945405994.9425-May
26 May 2023900540.116306535.056306535.0525+26 May
27 May 2023518406.736824941.786824941.7825+26+27 May
28 May 2023 6824941.786824941.7825+26+27+ 28 May
29 May 2023891691.47716633.187716633.1825+26+27+ 28+29 May
30 May 20239657511.6417374144.8217374144.8225+26+27+ 28+29+30 May
31 May 202320182534.3137556679.1320182534.3131 May 2023
01 June 2023409500.4537966179.5820592034.7631 May & 1 Jun
02 June 20237340905.1845307084.7627932939.9431 May + 01 + 02 Jun
03 June 2023306657.6145613742.3728239597.5531 May + 01 + 02+03 Jun
04 June 2023 45613742.3728239597.5531 May + 01 + 02+03 + 04 Jun
05 June 20233462782.0249076524.3931702379.5731 May + 01 + 02+03 + 04 + 05 Jun

 

 

Abhilash_P_0-1686737772344.png

 




 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Abhilash_P ,

Please try to create a new column with below dax formula:

Column =
VAR cur_date = [Date]
VAR cur_sale = [Sales Amount]
VAR _a =
    EOMONTH ( [Date], 0 )
VAR _b =
    EOMONTH ( [Date], -1 )
VAR tmp =
    FILTER ( 'Table', [Date] <= EARLIER ( 'Table'[Date] ) && [Date] >= _b )
VAR _val =
    SUMX ( tmp, [Sales Amount] )
RETURN
    IF ( cur_date = _a, cur_sale, _val )

vbinbinyumsft_0-1686882086128.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thanks @Anonymous 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Abhilash_P ,

Please try to create a new column with below dax formula:

Column =
VAR cur_date = [Date]
VAR cur_sale = [Sales Amount]
VAR _a =
    EOMONTH ( [Date], 0 )
VAR _b =
    EOMONTH ( [Date], -1 )
VAR tmp =
    FILTER ( 'Table', [Date] <= EARLIER ( 'Table'[Date] ) && [Date] >= _b )
VAR _val =
    SUMX ( tmp, [Sales Amount] )
RETURN
    IF ( cur_date = _a, cur_sale, _val )

vbinbinyumsft_0-1686882086128.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks @Anonymous 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.