Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Year to Date on hourly values

Dear Community,


I hope you can help me. I know how to get a running total and year-to-date based on daily values. However, it doesn't work for hourly values. Is there a "standard" way to get a year-to-date value for hourly values?


Looking forward to your feedback.


Best regards


Super User
Super User

@Manuel123 , if you need till now


YTD Now=
var _min = date(year(today()),1,1)
var _day = Now()
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Datetime] >=_min && 'Date'[Datetime] <= _day) )



If you need put hour too, then you need to have date and time table


YTD= CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year Rank]=max('Date'[Year Rank]) && 'Date'[Day of Year] <= Max('Date'[Day of Year]) )
, filter(all(Time), time[Hour] <= max(time[Hour])))



column you need


in date Table

Day of Year =datediff([Year Start date] , [Date],Day) +1




In fact to separate date and time


Date = [datetime].date
Date = date(year([datetime]),month([datetime]),day([datetime]))


Time = [datetime].Time
Time = Time(hour([datetime]),minute([datetime]),second([datetime]))


Power BI Features || Datamarts: || Field Parameters :
Time Intelligence Decoded : || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Dear @amitchandak,


thank you very much. What do you mean by 'Date'[Year Rank]?


Best regards


Helpful resources

September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Show episode 9

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 25

Ted's Dev Camp - August 25, 2022

Watch Session 25 of Ted's Dev Camp.

Top Solution Authors