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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
jinny_le
Frequent Visitor

How to do cumulative sum with conditional First date

Hello, 

I need help on how to calculate the accumulative sales for FYTD (Fiscal year to date). Fiscal year start on July each year. 

So after July, the FYTD sale will be accumulative sum. My data looks something like below and I need to calculate Column C. Any suggestion? 

 

ABC
Date Sales FYTD Sales
Jan-1710=10
Feb-1720=10+20
Mar-1730=10+20+30
Apr-1740=10+20+30+40
May-1750=10+20+30+40+50
Jun-1760=10+20+30+40+50+60
Jul-1770=70
Aug-1780=70+80
Sep-1790=70+80+90
Oct-17100=70+80+90+100
Nov-17110=70+80+90+100+110
Dec-17120=70+80+90+100+110+120
Jan-18130=70+80+90+100+110+120+130
Feb-18140=70+80+90+100+110+120+130+140
Mar-18150=70+80+90+100+110+120+130+140+150
Apr-18160=70+80+90+100+110+120+130+140+150+160
May-18170=70+80+90+100+110+120+130+140+150+160+170
Jun-18180=70+80+90+100+110+120+130+140+150+160+170+180
Jul-18190=190
Aug-18200=190+200

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jinny_le ,

 

Please create a fiscal year and then create a measure to calculate the running total for YTD based on fiscal year.

Calculated Columns:

FY = IF('Sample'[Date].[MonthNo]>6,'Sample'[Date].[Year]+1,'Sample'[Date].[Year])
Measure:
Running Total = CALCULATE(
                           SUM('Sample'[Sales]),
                           FILTER(ALL('Sample'),'Sample'[Date]<=MAX('Sample'[Date]))
                           ,VALUES('Sample'[FY])
                          )


Output:

Running Total.PNG

Best Regards,
Mail2inba4

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

3 REPLIES 3
Anonymous
Not applicable

Hi @jinny_le ,

 

Please create a fiscal year and then create a measure to calculate the running total for YTD based on fiscal year.

Calculated Columns:

FY = IF('Sample'[Date].[MonthNo]>6,'Sample'[Date].[Year]+1,'Sample'[Date].[Year])
Measure:
Running Total = CALCULATE(
                           SUM('Sample'[Sales]),
                           FILTER(ALL('Sample'),'Sample'[Date]<=MAX('Sample'[Date]))
                           ,VALUES('Sample'[FY])
                          )


Output:

Running Total.PNG

Best Regards,
Mail2inba4

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fantastic! Thank you 🙂 

Nathaniel_C
Super User
Super User

@jinny_le ,
Try this: x is my table.
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel
date.PNG

 



FYTD = TOTALYTD(sum(x[Sales ]),x[Date],ALL(x),"6/31")

 





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

Proud to be a Super User!




Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.