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
unknown_anony
Helper II
Helper II

Calculate YTD sum of previous month from the maximum month

Hello All,

I have a table which has the data till Sept which is the maximum month . i have a date column first of everymonth  in the Table.I want to have the YTD value till prevoius month of maximum month
How to calculate the sum? 

Thank you in advance
I got lot of support form you guys.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @unknown_anony ,

Please have a try.

YTD Sales = 
VAR MaxMonth = MAX(Orders[Order_Date].[MonthNo])
VAR PrevMonth = MaxMonth - 1
RETURN
TOTALYTD(SUM(Orders[Sales]), Orders[Order_Date], Orders[Order_Date].[MonthNo] <= PrevMonth)

 TOTALYTD function (DAX) - DAX | Microsoft Learn

 

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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 @unknown_anony ,

Please have a try.

YTD Sales = 
VAR MaxMonth = MAX(Orders[Order_Date].[MonthNo])
VAR PrevMonth = MaxMonth - 1
RETURN
TOTALYTD(SUM(Orders[Sales]), Orders[Order_Date], Orders[Order_Date].[MonthNo] <= PrevMonth)

 TOTALYTD function (DAX) - DAX | Microsoft Learn

 

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

 

 

 

Ahmedx
Super User
Super User

Can you please share your demo input and expected output!

Thankn you @Anonymous .
The above solution worked fine @Ahmedx . Thank you 

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.