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
Priyesh
Frequent Visitor

How to Calculate YTD Based on Start Date and End Date Slicer.

Hi Team,

 

I am calculating YTD which is working fine. Below is my calculation-

 

YTD Derived Risk = TOTALYTD(
    (SUM(HCTA_FACT_CLM[DERIV_RISK_AMT_COMP])),
   'Calendar'[Date]
)
My requirement is that the YTD should work on a start and end date slicer. So That user will select the start Date and end date and the YTD should Calculate accodingly. I am not sure how to calculate the Start and End Date slicers and how they will work in the Dax to calculate YTD.
 
Any help would be really Appreciated.
 
3 REPLIES 3
Thennarasu_R
Responsive Resident
Responsive Resident

@Priyesh 

use this calculation to selcted date Cummulative

Cumulative Total Up To Selected Date =
VAR SelectedMaxDate = MAX('Date'[Date])
VAR SelectedMinDate = MIN('Date'[Date])
RETURN
SUMX(
    FILTER(
        ALL('Date'),  
        'Date'[Date] >=SelectedMinDate && 'Date'[Date] <= SelectedMaxDate
    ),
    CALCULATE(SUM('Table'[Value]))
)

Thanks,
Thennarasu R
Idrissshatila
Super User
Super User

Hello @Priyesh ,

 

check the following https://youtu.be/RH785pBFwDI?si=zbOK4Tx_jo2UYyPl

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Hi @Idrissshatila  This video is showing to calculate values between two dates. My requirenment is different I want to calculate YTD,MTD based on the selected date in my slicers.For example If I select start Month and end month in the Slicer the YTD should be calculated for the given period only. In Tableau we used to do the same using parameters but not sure about Power BI.

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.