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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
W33628
Frequent Visitor

Calculate Rolling YTD to compare with same Date Range of Previous Years

Hi, I am trying to calculate a Rolling YTD SUM of Revenue and compare that with previous years for the same date range. For example, today is July 3rd, I want to see my YTD revenue and compare that with the YTD revenue for 2017 and 2018 up to July 3rd. How can I create a measure to show this as a rolling total on a line chart? 

 

I currently have this formula: 

Cumulative Revenue1 = CALCULATE(SUM(factRevenue[RevenueAmount]),
FILTER(ALLSELECTED(factRevenue[RevEarnedDate].[Day]),
ISONORAFTER(factRevenue[RevEarnedDate].[Day],Max(factRevenue[RevEarnedDate].[Day]),DESC)))

Which produces this: 

pbi.PNG

 

How can I limit the 2017 and 2018 lines to just be through today. 

2 REPLIES 2
dax
Community Support
Community Support

Hi W33628,

If you want to get rolling value based on today() for same period, right? Below is my design:

My sample

20.png

Measure 10 =
IF (
    MONTH ( MIN ( rolling[DATE] ) ) <= MONTH ( TODAY () )
        && DAY ( MIN ( rolling[DATE] ) ) <= DAY ( TODAY () ),
    CALCULATE (
        TOTALYTD ( SUM ( rolling[quantity] ), rolling[DATE], ALL ( rolling ) )
    ),
    BLANK ()
)

Capture13.PNG

If you want show 12 month in x-axis, you could set x-axis ->end=12

 

Best Regards,

Zoe Zhi

 

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

W33628
Frequent Visitor

In using that formula I am still gettting all of July for 2017 and 2018 in my chart rather than just through the partial month of July.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Solution Authors