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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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