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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
JohnnyC
New Member

YTD Sales - exlude data with future date

Hi All,

 

I'm trying to get YTD value of a column (service fees). I have calender column and the YTD sum looks to work fine but it is summing all values.

My issue is that there is data in there with renewal date in the future. Eg today is 29th August i just want to see the sum of service fees from 1st Jan until today ( i want to exclude any with future renewal date if that makes sense)

 

Does anyone know how i can do this?

 

thanks,

Johnny

1 ACCEPTED SOLUTION
xifeng_L
Super User
Super User

You can try the TOTALYTD or DATESYTD functions. Eg: 

 

MeasureName = CALCULATE(SUM('Table'[Values]),DATESYTD('Calendar'[Date]=TODAY()))

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

View solution in original post

3 REPLIES 3
xifeng_L
Super User
Super User

You can try the TOTALYTD or DATESYTD functions. Eg: 

 

MeasureName = CALCULATE(SUM('Table'[Values]),DATESYTD('Calendar'[Date]=TODAY()))

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

that's it - I've been all morning trying to get that (i'm not an IT guy but learning). thanks a mil

Rupak_bi
Super User
Super User

Hi,

The  DAX is as below based on what you have asked. I am assuming there is no groupby or other filters to take care.

YTD =

calculate(

          sum(table[values]),All(Table),table[date]>=date(2024,1,1)&&Table[date]<=today()

)



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.